From 4c6b1c3dec542458ed97afea9265a01aa138c551 Mon Sep 17 00:00:00 2001 From: Wei-Cheng Pan Date: Wed, 6 Sep 2017 15:42:05 +0800 Subject: [PATCH] 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 --HG-- extra : rebase_source : e31ed0d2471150bfdf30ac656f39795d11a4fed5 --- layout/base/ServoRestyleManager.cpp | 6 ++++++ layout/base/ServoRestyleManager.h | 1 + layout/style/ServoBindingList.h | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/layout/base/ServoRestyleManager.cpp b/layout/base/ServoRestyleManager.cpp index 830747faf5d2..90037333f08e 100644 --- a/layout/base/ServoRestyleManager.cpp +++ b/layout/base/ServoRestyleManager.cpp @@ -1202,6 +1202,12 @@ ServoRestyleManager::ProcessAllPendingAttributeAndStateInvalidations() ClearSnapshots(); } +bool +ServoRestyleManager::HasPendingRestyleAncestor(Element* aElement) const +{ + return Servo_HasPendingRestyleAncestor(aElement); +} + void ServoRestyleManager::UpdateOnlyAnimationStyles() { diff --git a/layout/base/ServoRestyleManager.h b/layout/base/ServoRestyleManager.h index f9ac36fadb3b..9fb16d1fe17b 100644 --- a/layout/base/ServoRestyleManager.h +++ b/layout/base/ServoRestyleManager.h @@ -188,6 +188,7 @@ public: nsRestyleHint aRestyleHint); void ProcessPendingRestyles(); void ProcessAllPendingAttributeAndStateInvalidations(); + bool HasPendingRestyleAncestor(dom::Element* aElement) const; /** * Performs a Servo animation-only traversal to compute style for all nodes diff --git a/layout/style/ServoBindingList.h b/layout/style/ServoBindingList.h index 72de40f133c5..8e0bd8a0e6e5 100644 --- a/layout/style/ServoBindingList.h +++ b/layout/style/ServoBindingList.h @@ -646,6 +646,10 @@ SERVO_BINDING_FUNC(Servo_ProcessInvalidations, void, 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) \