Bug 1312328 - Remove CSS variables preference "layout.css.variables.enabled". draft
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 07 Apr 2017 00:29:39 +0800
changeset 557601 80f8bd5433aa4f1e9bd76164af15584937e0bb9a
parent 556622 ec8d1d3db50c85037e8077c32c8403570a5df493
child 623099 8e32396b3108cfe5f3703abfc95fbe1ef8312a01
push id52765
push userbmo:tlin@mozilla.com
push dateFri, 07 Apr 2017 02:10:10 +0000
bugs1312328
milestone55.0a1
Bug 1312328 - Remove CSS variables preference "layout.css.variables.enabled". MozReview-Commit-ID: HwYpwbhQkZj
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/reftests/css-variables/reftest-stylo.list
layout/reftests/css-variables/reftest.list
layout/reftests/w3c-css/submitted/variables/reftest-stylo.list
layout/reftests/w3c-css/submitted/variables/reftest.list
layout/style/nsCSSParser.cpp
layout/style/nsCSSProps.cpp
layout/style/test/chrome/test_author_specified_style.html
layout/style/test/test_css_supports_variables.html
layout/style/test/test_value_storage.html
layout/style/test/test_variable_serialization_computed.html
layout/style/test/test_variable_serialization_specified.html
layout/style/test/test_variables.html
modules/libpref/init/all.js
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -178,17 +178,16 @@ typedef nsStyleTransformMatrix::Transfor
 /* static */ int32_t  nsLayoutUtils::sFontSizeInflationMappingIntercept;
 /* static */ uint32_t nsLayoutUtils::sFontSizeInflationMaxRatio;
 /* static */ bool nsLayoutUtils::sFontSizeInflationForceEnabled;
 /* static */ bool nsLayoutUtils::sFontSizeInflationDisabledInMasterProcess;
 /* static */ uint32_t nsLayoutUtils::sSystemFontScale;
 /* static */ uint32_t nsLayoutUtils::sZoomMaxPercent;
 /* static */ uint32_t nsLayoutUtils::sZoomMinPercent;
 /* static */ bool nsLayoutUtils::sInvalidationDebuggingIsEnabled;
-/* static */ bool nsLayoutUtils::sCSSVariablesEnabled;
 /* static */ bool nsLayoutUtils::sInterruptibleReflowEnabled;
 /* static */ bool nsLayoutUtils::sSVGTransformBoxEnabled;
 /* static */ bool nsLayoutUtils::sTextCombineUprightDigitsEnabled;
 #ifdef MOZ_STYLO
 /* static */ bool nsLayoutUtils::sStyloEnabled;
 #endif
 /* static */ bool nsLayoutUtils::sStyleAttrWithXMLBaseDisabled;
 /* static */ uint32_t nsLayoutUtils::sIdlePeriodDeadlineLimit;
@@ -7716,18 +7715,16 @@ nsLayoutUtils::Initialize()
   Preferences::AddUintVarCache(&sSystemFontScale,
                                "font.size.systemFontScale", 100);
   Preferences::AddUintVarCache(&sZoomMaxPercent,
                                "zoom.maxPercent", 300);
   Preferences::AddUintVarCache(&sZoomMinPercent,
                                "zoom.minPercent", 30);
   Preferences::AddBoolVarCache(&sInvalidationDebuggingIsEnabled,
                                "nglayout.debug.invalidation");
-  Preferences::AddBoolVarCache(&sCSSVariablesEnabled,
-                               "layout.css.variables.enabled");
   Preferences::AddBoolVarCache(&sInterruptibleReflowEnabled,
                                "layout.interruptible-reflow.enabled");
   Preferences::AddBoolVarCache(&sSVGTransformBoxEnabled,
                                "svg.transform-box.enabled");
   Preferences::AddBoolVarCache(&sTextCombineUprightDigitsEnabled,
                                "layout.css.text-combine-upright-digits.enabled");
 #ifdef MOZ_STYLO
   Preferences::AddBoolVarCache(&sStyloEnabled,
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2331,24 +2331,16 @@ public:
   static bool IsGridTemplateSubgridValueEnabled();
 
   /**
    * Checks whether support for the CSS text-align (and text-align-last)
    * 'true' value is enabled.
    */
   static bool IsTextAlignUnsafeValueEnabled();
 
-  /**
-   * Checks if CSS variables are currently enabled.
-   */
-  static bool CSSVariablesEnabled()
-  {
-    return sCSSVariablesEnabled;
-  }
-
   static bool InterruptibleReflowEnabled()
   {
     return sInterruptibleReflowEnabled;
   }
 
   /**
    * Unions the overflow areas of the children of aFrame with aOverflowAreas.
    * aSkipChildLists specifies any child lists that should be skipped.
@@ -2938,17 +2930,16 @@ private:
   static int32_t  sFontSizeInflationMappingIntercept;
   static uint32_t sFontSizeInflationMaxRatio;
   static bool sFontSizeInflationForceEnabled;
   static bool sFontSizeInflationDisabledInMasterProcess;
   static uint32_t sSystemFontScale;
   static uint32_t sZoomMaxPercent;
   static uint32_t sZoomMinPercent;
   static bool sInvalidationDebuggingIsEnabled;
-  static bool sCSSVariablesEnabled;
   static bool sInterruptibleReflowEnabled;
   static bool sSVGTransformBoxEnabled;
   static bool sTextCombineUprightDigitsEnabled;
 #ifdef MOZ_STYLO
   static bool sStyloEnabled;
 #endif
   static bool sStyleAttrWithXMLBaseDisabled;
   static uint32_t sIdlePeriodDeadlineLimit;
--- a/layout/reftests/css-variables/reftest-stylo.list
+++ b/layout/reftests/css-variables/reftest-stylo.list
@@ -1,5 +1,4 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
-default-preferences pref(layout.css.variables.enabled,true)
 
 == variables-ruletree-cache-01.html variables-ruletree-cache-01.html
 == variables-ruletree-cache-02.html variables-ruletree-cache-02.html
--- a/layout/reftests/css-variables/reftest.list
+++ b/layout/reftests/css-variables/reftest.list
@@ -1,4 +1,2 @@
-default-preferences pref(layout.css.variables.enabled,true)
-
 == variables-ruletree-cache-01.html variables-ruletree-cache-01-ref.html
 == variables-ruletree-cache-02.html variables-ruletree-cache-02-ref.html
--- a/layout/reftests/w3c-css/submitted/variables/reftest-stylo.list
+++ b/layout/reftests/w3c-css/submitted/variables/reftest-stylo.list
@@ -1,10 +1,9 @@
 # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
-default-preferences pref(layout.css.variables.enabled,true)
 
 == variable-declaration-01.html variable-declaration-01.html
 == variable-declaration-02.html variable-declaration-02.html
 == variable-declaration-03.html variable-declaration-03.html
 == variable-declaration-04.html variable-declaration-04.html
 == variable-declaration-05.html variable-declaration-05.html
 == variable-declaration-06.html variable-declaration-06.html
 == variable-declaration-07.html variable-declaration-07.html
--- a/layout/reftests/w3c-css/submitted/variables/reftest.list
+++ b/layout/reftests/w3c-css/submitted/variables/reftest.list
@@ -1,10 +1,8 @@
-default-preferences pref(layout.css.variables.enabled,true)
-
 == variable-declaration-01.html support/color-green-ref.html
 == variable-declaration-02.html support/color-green-ref.html
 == variable-declaration-03.html support/color-green-ref.html
 == variable-declaration-04.html support/color-green-ref.html
 == variable-declaration-05.html support/color-green-ref.html
 == variable-declaration-06.html support/color-green-ref.html
 == variable-declaration-07.html support/color-green-ref.html
 == variable-declaration-08.html support/color-green-ref.html
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -2060,18 +2060,16 @@ CSSParserImpl::ParseVariable(const nsASt
                              nsIPrincipal* aSheetPrincipal,
                              css::Declaration* aDeclaration,
                              bool* aChanged,
                              bool aIsImportant)
 {
   NS_PRECONDITION(aSheetPrincipal, "Must have principal here!");
   NS_PRECONDITION(aBaseURI, "need base URI");
   NS_PRECONDITION(aDeclaration, "Need declaration to parse into!");
-  NS_PRECONDITION(nsLayoutUtils::CSSVariablesEnabled(),
-                  "expected Variables to be enabled");
 
   mData.AssertInitialState();
   mTempData.AssertInitialState();
   aDeclaration->AssertMutable();
 
   nsCSSScanner scanner(aPropValue, 0);
   css::ErrorReporter reporter(scanner, mSheet, mChildLoader, aSheetURI);
   InitScanner(scanner, reporter, aSheetURI, aBaseURI, aSheetPrincipal);
@@ -7228,18 +7226,17 @@ CSSParserImpl::ParseDeclaration(css::Dec
   // Information about a parsed non-custom property.
   nsCSSPropertyID propID;
 
   // Information about a parsed custom property.
   CSSVariableDeclarations::Type variableType;
   nsString variableValue;
 
   // Check if the property name is a custom property.
-  bool customProperty = nsLayoutUtils::CSSVariablesEnabled() &&
-                        nsCSSProps::IsCustomPropertyName(propertyName) &&
+  bool customProperty = nsCSSProps::IsCustomPropertyName(propertyName) &&
                         aContext == eCSSContext_General;
 
   if (customProperty) {
     if (!ParseVariableDeclaration(&variableType, variableValue)) {
       REPORT_UNEXPECTED_P(PEValueParsingError, propertyName);
       REPORT_UNEXPECTED(PEDeclDropped);
       OUTPUT_ERROR();
       return false;
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -516,18 +516,17 @@ nsCSSProps::IsCustomPropertyName(const n
 }
 
 nsCSSPropertyID
 nsCSSProps::LookupProperty(const nsACString& aProperty,
                            EnabledState aEnabled)
 {
   MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref");
 
-  if (nsLayoutUtils::CSSVariablesEnabled() &&
-      IsCustomPropertyName(aProperty)) {
+  if (IsCustomPropertyName(aProperty)) {
     return eCSSPropertyExtra_variable;
   }
 
   nsCSSPropertyID res = nsCSSPropertyID(gPropertyTable->Lookup(aProperty));
   if (MOZ_LIKELY(res < eCSSProperty_COUNT)) {
     if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) {
       res = eCSSProperty_UNKNOWN;
     }
@@ -547,18 +546,17 @@ nsCSSProps::LookupProperty(const nsACStr
     }
   }
   return eCSSProperty_UNKNOWN;
 }
 
 nsCSSPropertyID
 nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled)
 {
-  if (nsLayoutUtils::CSSVariablesEnabled() &&
-      IsCustomPropertyName(aProperty)) {
+  if (IsCustomPropertyName(aProperty)) {
     return eCSSPropertyExtra_variable;
   }
 
   // This is faster than converting and calling
   // LookupProperty(nsACString&).  The table will do its own
   // converting and avoid a PromiseFlatCString() call.
   MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref");
   nsCSSPropertyID res = nsCSSPropertyID(gPropertyTable->Lookup(aProperty));
--- a/layout/style/test/chrome/test_author_specified_style.html
+++ b/layout/style/test/chrome/test_author_specified_style.html
@@ -45,11 +45,10 @@ function runTest() {
   // also test a custom property
   span.setAttribute("style", "--color: rgb(10%,25%,99%)");
   is(span.style.getAuthoredPropertyValue("--color"), " rgb(10%,25%,99%)", "specified --color");
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({ set: [["layout.css.variables.enabled", true]] },
-                          runTest);
+runTest();
 </script>
--- a/layout/style/test/test_css_supports_variables.html
+++ b/layout/style/test/test_css_supports_variables.html
@@ -235,13 +235,13 @@ function runTest()
   failingDeclarations.forEach(function(aDeclaration) {
     is(CSS.supports(aDeclaration[0], aDeclaration[1]), false, "CSS.supports returns false for unsupported declaration \"" + aDeclaration.join(":") + "\"");
   });
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({ "set": [["layout.css.variables.enabled", true]] }, runTest);
+runTest();
 </script>
 </pre>
 </body>
 </html>
--- a/layout/style/test/test_value_storage.html
+++ b/layout/style/test/test_value_storage.html
@@ -310,17 +310,16 @@ function test_property(property)
     }
   }
 
 }
 
 function runTest() {
   // To avoid triggering the slow script dialog, we have to test one
   // property at a time.
-  ok(SpecialPowers.getBoolPref("layout.css.variables.enabled"), "pref not set #1");
   var props = [];
   for (var prop in gCSSProperties) {
     var info = gCSSProperties[prop];
     if ("subproperties" in info) {
       for (var idx in info.subproperties) {
         var subprop = info.subproperties[idx];
         if (!(subprop in gPropertyShorthands)) {
           gPropertyShorthands[subprop] = [];
@@ -339,15 +338,13 @@ function runTest() {
     test_property(props.pop());
     SimpleTest.executeSoon(do_one);
   }
   SimpleTest.executeSoon(do_one);
 }
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestLongerTimeout(7);
-
-SpecialPowers.pushPrefEnv({ set: [["layout.css.variables.enabled", true]] },
-                          runTest);
+runTest();
 </script>
 </pre>
 </body>
 </html>
--- a/layout/style/test/test_variable_serialization_computed.html
+++ b/layout/style/test/test_variable_serialization_computed.html
@@ -72,11 +72,10 @@ function runTest() {
     var cs = getComputedStyle(span, "");
     is(cs.getPropertyValue(property), expected, "subtest #" + i);
   });
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({ set: [["layout.css.variables.enabled", true]] },
-                          runTest);
+runTest();
 </script>
--- a/layout/style/test/test_variable_serialization_specified.html
+++ b/layout/style/test/test_variable_serialization_specified.html
@@ -107,11 +107,10 @@ function runTest() {
   values_with_changed_specified_value_serialization.forEach(function(pair) {
     test_specified_value_serialization(pair[0], pair[1]);
   });
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({ set: [["layout.css.variables.enabled", true]] },
-                          runTest);
+runTest();
 </script>
--- a/layout/style/test/test_variables.html
+++ b/layout/style/test/test_variables.html
@@ -129,11 +129,10 @@ function prepareTest() {
 }
 
 function runTest() {
   tests.forEach(function(fn) { fn(); });
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({ set: [["layout.css.variables.enabled", true ]] },
-                          prepareTest);
+prepareTest();
 </script>
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2777,19 +2777,16 @@ pref("layout.css.osx-font-smoothing.enab
 #endif
 
 // Is support for the CSS-wide "unset" value enabled?
 pref("layout.css.unset-value.enabled", true);
 
 // Is support for the "all" shorthand enabled?
 pref("layout.css.all-shorthand.enabled", true);
 
-// Is support for CSS variables enabled?
-pref("layout.css.variables.enabled", true);
-
 // Is support for CSS overflow-clip-box enabled for non-UA sheets?
 pref("layout.css.overflow-clip-box.enabled", false);
 
 // Is support for CSS grid enabled?
 pref("layout.css.grid.enabled", true);
 
 // Is support for CSS "grid-template-{columns,rows}: subgrid X" enabled?
 pref("layout.css.grid-template-subgrid-value.enabled", false);