Bug 1477553: Hide display: -moz-box|-moz-inline-box from content on Nightly and early beta. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 22 Jul 2018 16:10:23 +0200
changeset 427815 599977a50d92cfa1493e4c2d76f53c8c7d40e3ae
parent 427814 ccef9e2643a19668dc06426aa0e55ed5d61ae535
child 427816 ce374736cb001e60a6f09f4b219938eb401bf04c
push id34318
push userccoroiu@mozilla.com
push dateMon, 23 Jul 2018 21:44:05 +0000
treeherdermozilla-central@fe48e26ca88c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1477553
milestone63.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 1477553: Hide display: -moz-box|-moz-inline-box from content on Nightly and early beta. r=xidorn Differential Revision: https://phabricator.services.mozilla.com/D2288 MozReview-Commit-ID: F9BeAneKY6e
browser/base/content/test/static/browser_parsable_css.js
layout/generic/crashtests/crashtests.list
layout/reftests/box-ordinal/reftest.list
layout/reftests/bugs/reftest.list
layout/reftests/text-overflow/reftest.list
layout/style/test/test_flexbox_child_display_values.xhtml
layout/style/test/test_layout_css_xul_display_values_content_enabled.html
layout/style/test/test_non_content_accessible_values.html
modules/libpref/init/StaticPrefList.h
servo/components/style/values/specified/box.rs
--- a/browser/base/content/test/static/browser_parsable_css.js
+++ b/browser/base/content/test/static/browser_parsable_css.js
@@ -62,16 +62,25 @@ let whitelist = [
    errorMessage: /Property contained reference to invalid variable.*background/i,
    isFromDevTools: true},
   {sourceName: /devtools\/skin\/animationinspector\.css$/i,
    intermittent: true,
    errorMessage: /Property contained reference to invalid variable.*color/i,
    isFromDevTools: true},
 ];
 
+if (!Services.prefs.getBoolPref("layout.css.xul-box-display-values.content.enabled")) {
+  // These are UA sheets which use non-content-exposed `display` values.
+  whitelist.push({
+    sourceName: /(skin\/shared\/Heartbeat|((?:res|gre-resources)\/(ua|html)))\.css$/i,
+    errorMessage: /Error in parsing value for .*\bdisplay\b/i,
+    isFromDevTools: false
+  });
+}
+
 if (!Services.prefs.getBoolPref("full-screen-api.unprefix.enabled")) {
   whitelist.push({
     sourceName: /(?:res|gre-resources)\/(ua|html)\.css$/i,
     errorMessage: /Unknown pseudo-class .*\bfullscreen\b/i,
     isFromDevTools: false
   }, {
     // PDFjs is futureproofing its pseudoselectors, and those rules are dropped.
     sourceName: /web\/viewer\.css$/i,
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -647,18 +647,18 @@ load text-overflow-bug713610.html
 load text-overflow-form-elements.html
 load text-overflow-iframe.html
 asserts(1-4) load 1225005.html # bug 682647 and bug 448083
 load 1233191.html
 load 1233607.html
 load 1234701-1.html
 load 1234701-2.html
 load 1271765.html
-asserts(2) asserts-if(Android,1) load 1272983-1.html # bug 586628
-asserts(2) asserts-if(Android,1) load 1272983-2.html # bug 586628
+pref(layout.css.xul-box-display-values.content.enabled,true) asserts(2) asserts-if(Android,1) load 1272983-1.html # bug 586628
+pref(layout.css.xul-box-display-values.content.enabled,true) asserts(2) asserts-if(Android,1) load 1272983-2.html # bug 586628
 load 1275059.html
 load 1278007.html
 load 1278080.html
 load 1279814.html
 skip-if(webrender) load large-border-radius-dashed.html # see bug 1409243, not handled by webrender
 skip-if(webrender) load large-border-radius-dashed2.html # see bug 1409243, not handled by webrender
 skip-if(webrender) load large-border-radius-dotted.html # see bug 1409243, not handled by webrender
 skip-if(webrender) load large-border-radius-dotted2.html # see bug 1409243, not handled by webrender
--- a/layout/reftests/box-ordinal/reftest.list
+++ b/layout/reftests/box-ordinal/reftest.list
@@ -1,7 +1,7 @@
-== box-ordinal-with-out-of-flow-1.html box-ordinal-with-out-of-flow-1-ref.html
+pref(layout.css.xul-box-display-values.content.enabled,true) == box-ordinal-with-out-of-flow-1.html box-ordinal-with-out-of-flow-1-ref.html
 == dynamic-1-remove-to-none-grouped.xul dynamic-1-ref.xul
 == dynamic-1-add-to-one-grouped.xul dynamic-1-ref.xul
 == dynamic-1-remove-to-one-grouped-1.xul dynamic-1-ref.xul
 fails == dynamic-1-remove-to-one-grouped-2.xul dynamic-1-ref.xul # bug 575500
 == dynamic-1-add-to-two-grouped-1.xul dynamic-1-ref.xul
 == dynamic-1-add-to-two-grouped-2.xul dynamic-1-ref.xul
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -412,17 +412,17 @@ fuzzy-if(Android,2,18) == 315920-17.html
 == 320979-1.html 320979-1-ref.html
 != 321402-1.html about:blank
 != 321402-2.html about:blank
 fuzzy-if(webrender&&winWidget,35-35,1-1) == 321402-3.xul 321402-3-ref.xul
 == 321402-4.xul 321402-4-ref.xul
 == 321402-5.xul 321402-5-ref.xul
 == 321402-6.xul 321402-6-ref.xul
 == 321738-1.html 321738-1-ref.html
-== 322436-1.html 322436-1-ref.html
+pref(layout.css.xul-box-display-values.content.enabled,true) == 322436-1.html 322436-1-ref.html
 == 322461-1.xml 322461-1-ref.html
 == 323656-1.html 323656-1-ref.html
 == 323656-2.html 323656-2-ref.html
 == 323656-3.html 323656-3-ref.html
 == 323656-4.html 323656-4-ref.html
 == 323656-5.svg 323656-5-ref.svg
 == 323656-6.html 323656-6-ref.html
 fuzzy-if(Android,2,140) == 325292-1.html 325292-1-ref.html
@@ -951,17 +951,17 @@ fails == 411585-3.html 411585-3-ref.html
 == 411792-1.html 411792-1-ref.html
 == 412093-1.html 412093-1-ref.html
 == 412352-1.html 412352-1-ref.html
 == 412352-2.html 412352-2-ref.html
 == 412607-1a.html 412607-1-ref.html
 == 412607-1b.html 412607-1-ref.html
 random-if(Android) == 412679-1.html 412679-1-ref.html
 fuzzy-if(skiaContent,1,17) == 412679-2.html 412679-2-ref.html
-== 413027-1.html 413027-1-ref.html
+pref(layout.css.xul-box-display-values.content.enabled,true) == 413027-1.html 413027-1-ref.html
 fails == 413027-2.html 413027-2-ref.html
 fails == 413027-3.html 413027-3-ref.html
 == 413286-1a.html 413286-1-ref.html
 == 413286-1b.html 413286-1-ref.html
 == 413286-1c.html 413286-1-ref.html
 == 413286-2a.html 413286-2-ref.html
 == 413286-2b.html 413286-2-ref.html
 == 413286-2c.html 413286-2-ref.html
@@ -1404,17 +1404,17 @@ fuzzy-if(Android,5,2800) == 506481-1.htm
 == 507187-1.html 507187-1-ref.html
 == 507487-1.html 507487-1-ref.html
 == 507487-2.xhtml 507487-2-ref.xhtml
 == 507762-1.html 507762-1-ref.html
 == 507762-2.html 507762-2-ref.html
 == 507762-3.html 507762-1-ref.html
 == 507762-4.html 507762-2-ref.html
 random == 508816-1.xul 508816-1-ref.xul # Bug 1375012
-== 508816-2.html 508816-2-ref.html
+pref(layout.css.xul-box-display-values.content.enabled,true) == 508816-2.html 508816-2-ref.html
 skip-if(isDebugBuild) == 508908-1.xul 508908-1-ref.xul
 == 508919-1.xhtml 508919-1-ref.xhtml
 == 509155-1.xhtml 509155-1-ref.xhtml
 fuzzy-if(Android,5,1656) fuzzy-if(skiaContent,1,1200) == 512410.html 512410-ref.html
 == 512631-1.html 512631-1-ref.html
 == 513153-1a.html 513153-1-ref.html
 == 513153-1b.html 513153-1-ref.html
 == 513153-2a.html 513153-2-ref.html
@@ -1444,17 +1444,17 @@ fuzzy-if(skiaContent,5,50) == 526463-1.h
 == 528038-1b.html 528038-1-ref.html
 == 528038-1c.html 528038-1-ref.html
 == 528038-1d.html 528038-1-ref.html
 == 528038-1e.html 528038-1-ref.html
 == 528038-1f.html 528038-1-ref.html
 == 528038-2.html 528038-2-ref.html
 == 528096-1.html 528096-1-ref.html
 == 530686-1.html 530686-1-ref.html
-== 531098-1.html 531098-1-ref.html
+pref(layout.css.xul-box-display-values.content.enabled,true) == 531098-1.html 531098-1-ref.html
 fuzzy-if(Android,2,48) == 531200-1.html 531200-1-ref.html
 == 531371-1.html 531371-1-ref.html
 == 534526-1a.html 534526-1-ref.html
 == 534526-1b.html 534526-1-ref.html
 == 534804-1.html 534804-1-ref.html
 == 534808-1.html 534808-1-ref.html
 == 534808-2.html 534808-2-ref.html
 == 534919-1.html 534919-1-ref.html
@@ -1559,17 +1559,17 @@ fuzzy-if(Android,1,1) needs-focus == 568
 == 574898-1.html 574898-ref.html
 # 574907 is a windows-only issue, result on other platforms depends on details of font support
 random-if(!winWidget) random-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)) == 574907-1.html 574907-1-ref.html # Bug 1258240
 random-if(!winWidget) random-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)) == 574907-2.html 574907-2-ref.html # Bug 1258240
 # 574907-3 only worked under directwrite, and even there it now depends on the rendering mode; marking as random for now
 random-if(!winWidget) fails-if(winWidget&&!dwrite) random-if(winWidget&&dwrite) != 574907-3.html 574907-3-notref.html
 == 577838-1.html 577838-1-ref.html
 == 577838-2.html 577838-2-ref.html
-== 579323-1.html 579323-1-ref.html
+pref(layout.css.xul-box-display-values.content.enabled,true) == 579323-1.html 579323-1-ref.html
 == 579349-1.html 579349-1-ref.html
 == 579655-1.html 579655-1-ref.html
 skip-if(!haveTestPlugin) fails-if(Android) HTTP == 579808-1.html 579808-1-ref.html
 fails-if(Android) random-if(layersGPUAccelerated) fuzzy-if(skiaContent,1,10000) == 579985-1.html 579985-1-ref.html # this bug was only for a regression in BasicLayers anyway
 skip-if(Android) == 580160-1.html 580160-1-ref.html # bug 920927 for Android; issues without the test-plugin
 fuzzy-if(asyncPan&&!layersGPUAccelerated,255,141) == 580863-1.html 580863-1-ref.html
 fails-if(Android) random-if(layersGPUAccelerated) fuzzy-if(skiaContent,1,6436) == 581317-1.html 581317-1-ref.html
 == 581579-1.html 581579-1-ref.html
--- a/layout/reftests/text-overflow/reftest.list
+++ b/layout/reftests/text-overflow/reftest.list
@@ -17,17 +17,17 @@ fuzzy-if(skiaContent,1,4200) fuzzy-if(we
 fuzzy-if(webrender,5,509) == marker-shadow.html marker-shadow-ref.html
 fuzzy-if(webrender,3,25) == aligned-baseline.html aligned-baseline-ref.html
 skip-if(Android) fuzzy-if(skiaContent,1,5) == clipped-elements.html clipped-elements-ref.html
 == theme-overflow.html theme-overflow-ref.html
 == table-cell.html table-cell-ref.html
 fuzzy-if(gtkWidget,10,32) fuzzy-if(webrender,47,18) == two-value-syntax.html two-value-syntax-ref.html
 == single-value.html single-value-ref.html
 fuzzy-if(gtkWidget,10,2) == atomic-under-marker.html atomic-under-marker-ref.html
-fuzzy(1,2616) skip-if(Android) fuzzy-if(asyncPan&&!layersGPUAccelerated,102,12352) fails-if(gtkWidget) == xulscroll.html xulscroll-ref.html # gtkWidget:bug 1309107, bug 1328771
+pref(layout.css.xul-box-display-values.content.enabled,true) fuzzy(1,2616) skip-if(Android) fuzzy-if(asyncPan&&!layersGPUAccelerated,102,12352) fails-if(gtkWidget) == xulscroll.html xulscroll-ref.html # gtkWidget:bug 1309107, bug 1328771
 == combobox-zoom.html combobox-zoom-ref.html
 == dynamic-change-1.html dynamic-change-1-ref.html
 == float-edges-1.html float-edges-1-ref.html
 
 # The vertical-text pref setting can be removed after bug 1138384 lands
 == vertical-decorations-1.html vertical-decorations-1-ref.html
 == vertical-decorations-2.html vertical-decorations-2-ref.html
 != vertical-decorations-1.html vertical-decorations-1-2-notref.html
--- a/layout/style/test/test_flexbox_child_display_values.xhtml
+++ b/layout/style/test/test_flexbox_child_display_values.xhtml
@@ -134,18 +134,16 @@ function main() {
   testDisplayValue("table");
   testDisplayValue("inline-table", "table");
 
   // These values all compute to "block" in a flex container. Do them in a
   // loop, so that I don't have to type "block" a zillion times.
   var dispValsThatComputeToBlockInAFlexContainer = [
     "inline",
     "inline-block",
-    "-moz-box",
-    "-moz-inline-box",
   ];
 
   dispValsThatComputeToBlockInAFlexContainer.forEach(
     function(aSpecifiedDisplay) {
       testDisplayValue(aSpecifiedDisplay, "block");
   });
 
   // Table-parts are special. When they're a child of a flex container,
--- a/layout/style/test/test_layout_css_xul_display_values_content_enabled.html
+++ b/layout/style/test/test_layout_css_xul_display_values_content_enabled.html
@@ -13,17 +13,20 @@ const VALUES = [
   "-moz-inline-stack",
   "-moz-deck",
   "-moz-popup",
   "-moz-groupbox",
 ];
 
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv(
-  {"set": [["layout.css.xul-display-values.content.enabled", true]]}
+  {"set": [
+    ["layout.css.xul-display-values.content.enabled", true],
+    ["layout.css.xul-box-display-values.content.enabled", true],
+  ]}
 ).then(runTest);
 
 function runTest() {
   const div = document.querySelector("div");
   for (const value of VALUES) {
     div.style.display = value;
     is(div.style.display, value);
     is(getComputedStyle(div).display, value);
--- a/layout/style/test/test_non_content_accessible_values.html
+++ b/layout/style/test/test_non_content_accessible_values.html
@@ -1,19 +1,18 @@
 <!doctype html>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <style id="sheet"></style>
 <div></div>
 <script>
 const NON_CONTENT_ACCESSIBLE_VALUES = {
   "display": [
-    // FIXME(emilio, bug TBD): Remove from content these two too.
-    // "-moz-box",
-    // "-moz-inline-box",
+    "-moz-box",
+    "-moz-inline-box",
     "-moz-grid",
     "-moz-inline-grid",
     "-moz-grid-group",
     "-moz-grid-line",
     "-moz-stack",
     "-moz-inline-stack",
     "-moz-deck",
     "-moz-popup",
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -356,16 +356,30 @@ VARCACHE_PREF(
 #undef PREF_VALUE
 
 VARCACHE_PREF(
   "layout.css.xul-display-values.content.enabled",
    layout_css_xul_display_values_content_enabled,
   bool, false
 )
 
+// Pref to control whether display: -moz-box and display: -moz-inline-box are
+// parsed in content pages.
+#ifdef EARLY_BETA_OR_EARLIER
+#define PREF_VALUE false
+#else
+#define PREF_VALUE true
+#endif
+VARCACHE_PREF(
+  "layout.css.xul-box-display-values.content.enabled",
+   layout_css_xul_box_display_values_content_enabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
 // Is support for CSS "grid-template-{columns,rows}: subgrid X" enabled?
 VARCACHE_PREF(
   "layout.css.grid-template-subgrid-value.enabled",
    layout_css_grid_template_subgrid_value_enabled,
   bool, false
 )
 
 // Is support for variation fonts enabled?
--- a/servo/components/style/values/specified/box.rs
+++ b/servo/components/style/values/specified/box.rs
@@ -25,16 +25,27 @@ fn moz_display_values_enabled(context: &
     use stylesheets::Origin;
     context.stylesheet_origin == Origin::UserAgent ||
     context.chrome_rules_enabled() ||
     unsafe {
         structs::StaticPrefs_sVarCache_layout_css_xul_display_values_content_enabled
     }
 }
 
+#[cfg(feature = "gecko")]
+fn moz_box_display_values_enabled(context: &ParserContext) -> bool {
+    use gecko_bindings::structs;
+    use stylesheets::Origin;
+    context.stylesheet_origin == Origin::UserAgent ||
+    context.chrome_rules_enabled() ||
+    unsafe {
+        structs::StaticPrefs_sVarCache_layout_css_xul_box_display_values_content_enabled
+    }
+}
+
 #[allow(missing_docs)]
 #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq,
          SpecifiedValueInfo, ToComputedValue, ToCss)]
 #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
 /// Defines an element’s display type, which consists of
 /// the two basic qualities of how an element generates boxes
 /// <https://drafts.csswg.org/css-display/#propdef-display>
 pub enum Display {
@@ -75,18 +86,20 @@ pub enum Display {
     Contents,
     #[cfg(feature = "gecko")]
     FlowRoot,
     #[cfg(feature = "gecko")]
     WebkitBox,
     #[cfg(feature = "gecko")]
     WebkitInlineBox,
     #[cfg(feature = "gecko")]
+    #[parse(condition = "moz_box_display_values_enabled")]
     MozBox,
     #[cfg(feature = "gecko")]
+    #[parse(condition = "moz_box_display_values_enabled")]
     MozInlineBox,
     #[cfg(feature = "gecko")]
     #[parse(condition = "moz_display_values_enabled")]
     MozGrid,
     #[cfg(feature = "gecko")]
     #[parse(condition = "moz_display_values_enabled")]
     MozInlineGrid,
     #[cfg(feature = "gecko")]