Bug 1382077 part 3 - Record viewport unit usage and generate proper restyle hint. r?heycam draft
authorXidorn Quan <me@upsuper.org>
Mon, 24 Jul 2017 13:02:17 +1000
changeset 615017 22d60bab78d435943034154a9cd5fa5982470c67
parent 615016 6b34aa9f3ff12b28c65d6d1dcb37e7661341ebd7
child 615018 2700e2402eaf1d2a642040fce7ae96a0757bd93c
push id70211
push userxquan@mozilla.com
push dateTue, 25 Jul 2017 09:31:10 +0000
reviewersheycam
bugs1382077
milestone56.0a1
Bug 1382077 part 3 - Record viewport unit usage and generate proper restyle hint. r?heycam MozReview-Commit-ID: FA2TiIejUT
layout/style/ServoBindingList.h
layout/style/ServoStyleSet.cpp
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -42,18 +42,18 @@ SERVO_BINDING_FUNC(Servo_StyleSheet_Clon
 SERVO_BINDING_FUNC(Servo_StyleSheet_SizeOfIncludingThis, size_t,
                    mozilla::MallocSizeOf malloc_size_of,
                    RawServoStyleSheetContentsBorrowed sheet)
 SERVO_BINDING_FUNC(Servo_StyleSet_Init, RawServoStyleSetOwned, RawGeckoPresContextOwned pres_context)
 SERVO_BINDING_FUNC(Servo_StyleSet_Clear, void,
                    RawServoStyleSetBorrowed set)
 SERVO_BINDING_FUNC(Servo_StyleSet_RebuildData, void,
                    RawServoStyleSetBorrowed set)
-SERVO_BINDING_FUNC(Servo_StyleSet_MediumFeaturesChanged, bool,
-                   RawServoStyleSetBorrowed set)
+SERVO_BINDING_FUNC(Servo_StyleSet_MediumFeaturesChanged, nsRestyleHint,
+                   RawServoStyleSetBorrowed set, bool viewport_changed)
 SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSetOwned set)
 SERVO_BINDING_FUNC(Servo_StyleSet_CompatModeChanged, void,
                    RawServoStyleSetBorrowed raw_data)
 SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
                    RawServoStyleSetBorrowed set,
                    const mozilla::ServoStyleSheet* gecko_sheet)
 SERVO_BINDING_FUNC(Servo_StyleSet_PrependStyleSheet, void,
                    RawServoStyleSetBorrowed set,
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -111,27 +111,17 @@ ServoStyleSet::InvalidateStyleForCSSRule
 {
   MOZ_ASSERT(StylistNeedsUpdate());
   mPresContext->RestyleManager()->AsServo()->PostRestyleEventForCSSRuleChanges();
 }
 
 nsRestyleHint
 ServoStyleSet::MediumFeaturesChanged(bool aViewportChanged) const
 {
-  if (Servo_StyleSet_MediumFeaturesChanged(mRawSet.get())) {
-    return eRestyle_Subtree;
-  }
-  if (aViewportChanged) {
-    // Rebuild all style data without rerunning selector matching.
-    //
-    // FIXME(emilio, bug 1328652): We don't set mUsesViewportUnits in stylo yet,
-    // so assume the worst.
-    return eRestyle_ForceDescendants;
-  }
-  return nsRestyleHint(0);
+  return Servo_StyleSet_MediumFeaturesChanged(mRawSet.get(), aViewportChanged);
 }
 
 size_t
 ServoStyleSet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   size_t n = aMallocSizeOf(this);
 
   if (mStyleRuleMap) {