Bug 1419355: Add a test for non-content-accessible properties, and make Stylo and Gecko consistent. r=xidorn
☠☠ backed out by e35aa16d84a6 ☠ ☠
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 21 Nov 2017 11:57:17 +0100
changeset 444704 39a68df1359c42e4a9343b7ca61fe3faf2a47472
parent 444703 ed6b21b2945d9ea4aa156ea079ea20d200d4a6a7
child 444705 64ee916b6bb9dcb0cd404b0f32aeb4cc140d4367
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1419355
milestone59.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 1419355: Add a test for non-content-accessible properties, and make Stylo and Gecko consistent. r=xidorn MozReview-Commit-ID: 2n773xkmAqX
devtools/shared/css/generated/properties-db.js
layout/style/nsCSSPropList.h
layout/style/test/mochitest.ini
layout/style/test/test_non_content_accessible_properties.html
--- a/devtools/shared/css/generated/properties-db.js
+++ b/devtools/shared/css/generated/properties-db.js
@@ -1496,62 +1496,16 @@ exports.CSS_PROPERTIES = {
       "default",
       "drag",
       "inherit",
       "initial",
       "no-drag",
       "unset"
     ]
   },
-  "-moz-window-opacity": {
-    "isInherited": false,
-    "subproperties": [
-      "-moz-window-opacity"
-    ],
-    "supports": [
-      7
-    ],
-    "values": [
-      "inherit",
-      "initial",
-      "unset"
-    ]
-  },
-  "-moz-window-transform": {
-    "isInherited": false,
-    "subproperties": [
-      "-moz-window-transform"
-    ],
-    "supports": [],
-    "values": [
-      "inherit",
-      "initial",
-      "unset"
-    ]
-  },
-  "-moz-window-transform-origin": {
-    "isInherited": false,
-    "subproperties": [
-      "-moz-window-transform-origin"
-    ],
-    "supports": [
-      6,
-      8
-    ],
-    "values": [
-      "bottom",
-      "center",
-      "inherit",
-      "initial",
-      "left",
-      "right",
-      "top",
-      "unset"
-    ]
-  },
   "-webkit-align-content": {
     "isInherited": false,
     "subproperties": [
       "align-content"
     ],
     "supports": [],
     "values": [
       "baseline",
--- a/layout/style/nsCSSPropList.h
+++ b/layout/style/nsCSSPropList.h
@@ -4495,41 +4495,45 @@ CSS_PROP_UIRESET(
     VARIANT_HK,
     kWindowShadowKTable,
     CSS_PROP_NO_OFFSET,
     eStyleAnimType_None)
 CSS_PROP_UIRESET(
     -moz-window-opacity,
     _moz_window_opacity,
     CSS_PROP_DOMPROP_PREFIXED(WindowOpacity),
-    CSS_PROPERTY_INTERNAL | CSS_PROPERTY_PARSE_VALUE,
+    CSS_PROPERTY_INTERNAL |
+        CSS_PROPERTY_PARSE_VALUE |
+        CSS_PROPERTY_ENABLED_IN_UA_SHEETS_AND_CHROME,
     "",
     VARIANT_HN,
     nullptr,
     offsetof(nsStyleUIReset, mWindowOpacity),
     eStyleAnimType_float)
 CSS_PROP_UIRESET(
     -moz-window-transform,
     _moz_window_transform,
     CSS_PROP_DOMPROP_PREFIXED(WindowTransform),
     CSS_PROPERTY_INTERNAL |
         CSS_PROPERTY_PARSE_FUNCTION |
+        CSS_PROPERTY_ENABLED_IN_UA_SHEETS_AND_CHROME |
         CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
     "",
     0,
     nullptr,
     offsetof(nsStyleUIReset, mSpecifiedWindowTransform),
     eStyleAnimType_Custom)
 CSS_PROP_UIRESET(
     -moz-window-transform-origin,
     _moz_window_transform_origin,
     CSS_PROP_DOMPROP_PREFIXED(WindowTransformOrigin),
     CSS_PROPERTY_INTERNAL |
         CSS_PROPERTY_PARSE_FUNCTION |
         CSS_PROPERTY_STORES_CALC |
+        CSS_PROPERTY_ENABLED_IN_UA_SHEETS_AND_CHROME |
         CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH,
     "",
     0,
     kImageLayerPositionKTable,
     CSS_PROP_NO_OFFSET,
     eStyleAnimType_Custom)
 #endif // CSS_PROP_LIST_EXCLUDE_INTERNAL
 CSS_PROP_TEXT(
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -248,16 +248,17 @@ skip-if = !stylo
 [test_media_queries.html]
 skip-if = android_version == '18' #debug-only failure; timed out #Android 4.3 aws only; bug 1030419
 [test_media_queries_dynamic.html]
 [test_media_queries_dynamic_xbl.html]
 [test_media_query_list.html]
 [test_media_query_serialization.html]
 [test_moz_device_pixel_ratio.html]
 [test_namespace_rule.html]
+[test_non_content_accessible_properties.html]
 [test_of_type_selectors.xhtml]
 [test_page_parser.html]
 [test_parse_eof.html]
 [test_parse_ident.html]
 [test_parse_rule.html]
 [test_parse_url.html]
 [test_parser_diagnostics_unprintables.html]
 [test_pixel_lengths.html]
new file mode 100644
--- /dev/null
+++ b/layout/style/test/test_non_content_accessible_properties.html
@@ -0,0 +1,56 @@
+<!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_PROPERTIES = [
+  "-x-span",
+  "-x-lang",
+  "-x-text-zoom",
+  "-moz-window-shadow",
+  "-moz-window-opacity",
+  "-moz-window-transform",
+  "-moz-window-transform-origin",
+  "-moz-top-layer",
+  "-moz-script-size-multiplier",
+  "-moz-script-level",
+  "-moz-math-display",
+  "-moz-math-variant",
+  "-moz-script-min-size",
+  "-moz-font-smoothing-background-color",
+  "-moz-min-font-size-ratio",
+  "-moz-script-size-multiplier",
+];
+
+const sheet = document.getElementById("sheet");
+const div = document.querySelector("div");
+
+test(function() {
+  sheet.textContent = `div { color: initial }`;
+  assert_equals(sheet.sheet.cssRules[0].style.length, 1);
+}, "sanity");
+
+for (const prop of NON_CONTENT_ACCESSIBLE_PROPERTIES) {
+  test(function() {
+    sheet.textContent = `div { ${prop}: initial }`;
+    let block = sheet.sheet.cssRules[0].style;
+    assert_equals(
+      block.length,
+      0,
+      prop + " shouldn't be parsed in content"
+    );
+    block.setProperty(prop, "initial");
+    assert_equals(
+      block.length,
+      0,
+      prop + " shouldn't be settable via CSSOM in content"
+    );
+    assert_equals(
+      getComputedStyle(div).getPropertyValue(prop),
+      "",
+      prop + " shouldn't be accessible via CSSOM in content"
+    );
+  }, prop);
+}
+</script>