Bug 1328652: Assume medium feature changes in nsPresContext::MediaFeatureValuesChanged. r=bz draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 11 Mar 2017 00:23:05 +0100
changeset 498439 dd0a71a2cbbea314e66f9f10f5aa52b2b62d59e6
parent 498360 2baef2ffbaedb7354286726660ebd36e84b432f0
child 498440 c5b8df6a9394ec7da7075b2c00e2a9f21d60933b
push id49184
push userbmo:emilio+bugs@crisal.io
push dateTue, 14 Mar 2017 18:54:29 +0000
reviewersbz
bugs1328652
milestone55.0a1
Bug 1328652: Assume medium feature changes in nsPresContext::MediaFeatureValuesChanged. r=bz This allows us to test our media query stuff at least, and works around the fact that we don't set mUsesViewportUnits. This will get us better test coverage, at the expense of more expensive window resizes and similar, temporarily. MozReview-Commit-ID: 7lgELz86lmW
layout/base/nsPresContext.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -2014,21 +2014,26 @@ nsPresContext::MediaFeatureValuesChanged
     // changes yet.
     if (mShell->StyleSet()->IsGecko()) {
       if (mShell->StyleSet()->AsGecko()->MediumFeaturesChanged()) {
         aRestyleHint |= eRestyle_Subtree;
       }
     } else {
       NS_WARNING("stylo: ServoStyleSets don't support responding to medium "
                  "changes yet. See bug 1290228.");
+      aRestyleHint |= eRestyle_Subtree;
     }
   }
 
   if (mUsesViewportUnits && mPendingViewportChange) {
     // Rebuild all style data without rerunning selector matching.
+    //
+    // TODO(emilio, bug 1328652): We don't set mUsesViewportUnits in stylo yet.
+    // This is wallpapered given we assume medium feature changes
+    // unconditionally, but we need to fix this.
     aRestyleHint |= eRestyle_ForceDescendants;
   }
 
   if (aRestyleHint || aChangeHint) {
     RebuildAllStyleData(aChangeHint, aRestyleHint);
   }
 
   mPendingViewportChange = false;