From 1e2c9293c623c1869b0dd549b9f13291a95ae7f8 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Wed, 1 Nov 2017 21:20:39 +1100 Subject: [PATCH] Bug 1390694 - Part 1: Add ServoStyleSet function for checking document state dependencies. r=emilio MozReview-Commit-ID: G8Ju8yHtYx6 --HG-- extra : rebase_source : 11f25c9b9b9a45144170ff9e563e52577ca8cea2 extra : source : 38302acda5cdb8a808ee80430488d83527a415ff --- layout/style/ServoBindingList.h | 3 +++ layout/style/ServoStyleSet.cpp | 7 +++++++ layout/style/ServoStyleSet.h | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/layout/style/ServoBindingList.h b/layout/style/ServoBindingList.h index eae6b75b86ed..95b49ef31dea 100644 --- a/layout/style/ServoBindingList.h +++ b/layout/style/ServoBindingList.h @@ -163,6 +163,9 @@ SERVO_BINDING_FUNC(Servo_StyleSet_HasStateDependency, bool, RawServoStyleSetBorrowed set, RawGeckoElementBorrowed element, uint64_t state) +SERVO_BINDING_FUNC(Servo_StyleSet_HasDocumentStateDependency, bool, + RawServoStyleSetBorrowed set, + uint64_t state) // CSSRuleList SERVO_BINDING_FUNC(Servo_CssRules_ListTypes, void, diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index 291aae4096e8..504f6dbec232 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -1603,6 +1603,13 @@ ServoStyleSet::HasStateDependency(const Element& aElement, mRawSet.get(), &aElement, aState.ServoValue()); } +bool +ServoStyleSet::HasDocumentStateDependency(EventStates aState) const +{ + return Servo_StyleSet_HasDocumentStateDependency( + mRawSet.get(), aState.ServoValue()); +} + already_AddRefed ServoStyleSet::ReparentStyleContext(ServoStyleContext* aStyleContext, ServoStyleContext* aNewParent, diff --git a/layout/style/ServoStyleSet.h b/layout/style/ServoStyleSet.h index 26380fa779b1..a226a698baf0 100644 --- a/layout/style/ServoStyleSet.h +++ b/layout/style/ServoStyleSet.h @@ -486,6 +486,12 @@ public: bool HasStateDependency(const dom::Element& aElement, EventStates aState) const; + /** + * Returns true if a change in document state might require us to restyle the + * document. + */ + bool HasDocumentStateDependency(EventStates aState) const; + /** * Get a new style context that uses the same rules as the given style context * but has a different parent.