Bug 1388298 - Add an API to process all invalidations on the main thread. r?emilio
MozReview-Commit-ID: I7rBwvPQykR
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -1106,16 +1106,27 @@ ServoRestyleManager::DoProcessPendingRes
void
ServoRestyleManager::ProcessPendingRestyles()
{
DoProcessPendingRestyles(ServoTraversalFlags::Empty);
}
void
+ServoRestyleManager::ProcessAllPendingAttributeAndStateInvalidations()
+{
+ AutoTimelineMarker marker(mPresContext->GetDocShell(),
+ "ProcessAllPendingAttributeAndStateInvalidations");
+ for (auto iter = mSnapshots.Iter(); !iter.Done(); iter.Next()) {
+ Servo_ProcessInvalidations(StyleSet()->RawSet(), iter.Key(), &mSnapshots);
+ }
+ ClearSnapshots();
+}
+
+void
ServoRestyleManager::UpdateOnlyAnimationStyles()
{
// Bug 1365855: We also need to implement this for SMIL.
bool doCSS = PresContext()->EffectCompositor()->HasPendingStyleUpdates();
if (!doCSS) {
return;
}
--- a/layout/base/ServoRestyleManager.h
+++ b/layout/base/ServoRestyleManager.h
@@ -180,16 +180,17 @@ public:
nsRestyleHint aRestyleHint,
nsChangeHint aMinChangeHint);
void PostRestyleEventForCSSRuleChanges();
void RebuildAllStyleData(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint);
void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint);
void ProcessPendingRestyles();
+ void ProcessAllPendingAttributeAndStateInvalidations();
/**
* Performs a Servo animation-only traversal to compute style for all nodes
* with the animation-only dirty bit in the document.
*
* This processes just the traversal for animation-only restyles and skips the
* normal traversal for other restyles unrelated to animations.
* This is used to bring throttled animations up-to-date such as when we need
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -615,14 +615,20 @@ SERVO_BINDING_FUNC(Servo_GetCustomProper
SERVO_BINDING_FUNC(Servo_GetCustomPropertiesCount, uint32_t,
ServoStyleContextBorrowed computed_values)
SERVO_BINDING_FUNC(Servo_GetCustomPropertyNameAt, bool,
ServoStyleContextBorrowed, uint32_t index,
nsAString* name)
+SERVO_BINDING_FUNC(Servo_ProcessInvalidations, void,
+ RawServoStyleSetBorrowed set,
+ RawGeckoElementBorrowed element,
+ const mozilla::ServoElementSnapshotTable* snapshots)
+
+
// AddRef / Release functions
#define SERVO_ARC_TYPE(name_, type_) \
SERVO_BINDING_FUNC(Servo_##name_##_AddRef, void, type_##Borrowed) \
SERVO_BINDING_FUNC(Servo_##name_##_Release, void, type_##Borrowed)
#include "mozilla/ServoArcTypeList.h"
#undef SERVO_ARC_TYPE