Bug 1397168 - Add a function to find out if a node has any ancestor that is pending for restyling. r?emilio draft
authorWei-Cheng Pan <wpan@mozilla.com>
Wed, 06 Sep 2017 15:42:05 +0800
changeset 659735 f502111c3f6be6fb36ad0bc2cb03523ab025fc59
parent 659384 f64e2b4dcf5eec0b4ad456c149680a67b7c26dc4
child 730054 1e5a0ef82e01aeaaed608f8c90db87c32f5463fe
push id78201
push userbmo:wpan@mozilla.com
push dateWed, 06 Sep 2017 08:56:59 +0000
reviewersemilio
bugs1397168
milestone57.0a1
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
layout/base/ServoRestyleManager.cpp
layout/base/ServoRestyleManager.h
layout/style/ServoBindingList.h
--- 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