Bug 1275452 - Part 1: Add Servo_RestyleSubtree for eagerly restyling a subtree of a document. r=bholley
authorCameron McCormack <cam@mcc.id.au>
Wed, 25 May 2016 16:55:49 +1000
changeset 337896 a51e41ec23e20c9dfdc00a221d5025f9bea795a1
parent 337895 484c1b1957f54397da35a38e311cdd0613c5ca3f
child 337897 ce7e41b72c76ca3cbb248115f66ce3fad3cef664
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1275452
milestone49.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 1275452 - Part 1: Add Servo_RestyleSubtree for eagerly restyling a subtree of a document. r=bholley
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -442,16 +442,22 @@ Servo_Initialize()
 
 void
 Servo_RestyleDocument(RawGeckoDocument* doc, RawServoStyleSet* set)
 {
   MOZ_CRASH("stylo: shouldn't be calling Servo_RestyleDocument in a "
             "non-MOZ_STYLO build");
 }
 
+void Servo_RestyleSubtree(RawGeckoNode* node, RawServoStyleSet* set)
+{
+  MOZ_CRASH("stylo: shouldn't be calling Servo_RestyleSubtree in a "
+            "non-MOZ_STYLO build");
+}
+
 #define STYLE_STRUCT(name_, checkdata_cb_)                                     \
 const nsStyle##name_*                                                          \
 Servo_GetStyle##name_(ServoComputedValues*)                                    \
 {                                                                              \
   MOZ_CRASH("stylo: shouldn't be calling Servo_GetStyle" #name_ " in a "       \
             "non-MOZ_STYLO build");                                            \
 }
 #include "nsStyleStructList.h"
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -150,18 +150,19 @@ ServoComputedValues* Servo_GetComputedVa
                                                              bool is_probe);
 ServoComputedValues* Servo_InheritComputedValues(ServoComputedValues* parent_style);
 void Servo_AddRefComputedValues(ServoComputedValues*);
 void Servo_ReleaseComputedValues(ServoComputedValues*);
 
 // Initialize Servo components. Should be called exactly once at startup.
 void Servo_Initialize();
 
-// Restyle the given document.
+// Restyle the given document or subtree.
 void Servo_RestyleDocument(RawGeckoDocument* doc, RawServoStyleSet* set);
+void Servo_RestyleSubtree(RawGeckoNode* node, RawServoStyleSet* set);
 
 // Style-struct management.
 #define STYLE_STRUCT(name, checkdata_cb) \
 struct nsStyle##name; \
 void Gecko_Construct_nsStyle##name(nsStyle##name* ptr); \
 void Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr, const nsStyle##name* other); \
 void Gecko_Destroy_nsStyle##name(nsStyle##name* ptr); \
 const nsStyle##name* Servo_GetStyle##name(ServoComputedValues* computedValues);
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -378,8 +378,14 @@ ServoStyleSet::HasStateDependentStyle(do
 nsRestyleHint
 ServoStyleSet::HasStateDependentStyle(dom::Element* aElement,
                                       CSSPseudoElementType aPseudoType,
                                      dom::Element* aPseudoElement,
                                      EventStates aStateMask)
 {
   MOZ_CRASH("stylo: not implemented");
 }
+
+void
+ServoStyleSet::RestyleSubtree(nsINode* aNode)
+{
+  Servo_RestyleSubtree(aNode, mRawSet.get());
+}
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -111,16 +111,18 @@ public:
   // Test if style is dependent on content state
   nsRestyleHint HasStateDependentStyle(dom::Element* aElement,
                                        EventStates aStateMask);
   nsRestyleHint HasStateDependentStyle(dom::Element* aElement,
                                        mozilla::CSSPseudoElementType aPseudoType,
                                        dom::Element* aPseudoElement,
                                        EventStates aStateMask);
 
+  void RestyleSubtree(nsINode* aNode);
+
 private:
   already_AddRefed<nsStyleContext> GetContext(already_AddRefed<ServoComputedValues>,
                                               nsStyleContext* aParentContext,
                                               nsIAtom* aPseudoTag,
                                               CSSPseudoElementType aPseudoType);
 
   already_AddRefed<nsStyleContext> GetContext(nsIContent* aContent,
                                               nsStyleContext* aParentContext,