Bug 1397168 - Add a function to find out if a node has any ancestor that is pending for restyling. r=emilio
authorWei-Cheng Pan <wpan@mozilla.com>
Wed, 06 Sep 2017 15:42:05 +0800
changeset 429163 d12b61881a56d3ba674dc83aca671f35fc511b26
parent 429162 10bbe3749f10369f5de33c21b56114d3ffeadc9f
child 429164 34db5bec9cad5bd0b83235b3d1a9ea1ebce8692a
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1397168
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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()
 {
   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
@@ -641,14 +641,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