Bug 1397168 - Add a function to find out if a node has any ancestor that is pending for restyling. r?emilio
MozReview-Commit-ID: DXcodMcQP59
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -1197,16 +1197,22 @@ ServoRestyleManager::ProcessAllPendingAt
AutoTimelineMarker marker(mPresContext->GetDocShell(),
"ProcessAllPendingAttributeAndStateInvalidations");
for (auto iter = mSnapshots.Iter(); !iter.Done(); iter.Next()) {
Servo_ProcessInvalidations(StyleSet()->RawSet(), iter.Key(), &mSnapshots);
}
ClearSnapshots();
}
+bool
+ServoRestyleManager::HasPendingRestyleAncestor(Element* aElement) const
+{
+ return Servo_HasPendingRestyleAncestor(aElement);
+}
+
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
@@ -183,16 +183,17 @@ public:
nsChangeHint aMinChangeHint);
void PostRestyleEventForCSSRuleChanges();
void RebuildAllStyleData(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint);
void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
nsRestyleHint aRestyleHint);
void ProcessPendingRestyles();
void ProcessAllPendingAttributeAndStateInvalidations();
+ bool HasPendingRestyleAncestor(dom::Element* aElement) const;
/**
* 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
@@ -639,14 +639,18 @@ SERVO_BINDING_FUNC(Servo_GetCustomProper
SERVO_BINDING_FUNC(Servo_ProcessInvalidations, void,
RawServoStyleSetBorrowed set,
RawGeckoElementBorrowed element,
const mozilla::ServoElementSnapshotTable* snapshots)
+SERVO_BINDING_FUNC(Servo_HasPendingRestyleAncestor, bool,
+ RawGeckoElementBorrowed element)
+
+
// 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