Bug 1470087: Tests for getComputedStyle on display: none subtrees. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 21 Jun 2018 11:27:40 +0200
changeset 477528 393be8743349aa97b9c3413cdc164f2d976cf34d
parent 477527 1440edb27dc4460e268387c57459506dbcbfe256
child 477529 4c8f6b544de1a3918199086d1bd4474855581bb5
push id9385
push userdluca@mozilla.com
push dateFri, 22 Jun 2018 15:47:18 +0000
treeherdermozilla-beta@82a9a1027e2b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1470087
milestone62.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 1470087: Tests for getComputedStyle on display: none subtrees. r=heycam MozReview-Commit-ID: B7UNVcTW0WG
testing/web-platform/meta/MANIFEST.json
testing/web-platform/meta/css/cssom/getComputedStyle-display-none-001.html.ini
testing/web-platform/tests/css/cssom/getComputedStyle-display-none-001.html
testing/web-platform/tests/css/cssom/getComputedStyle-display-none-002.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -324146,16 +324146,28 @@
     ]
    ],
    "css/cssom/getComputedStyle-detached-subtree.html": [
     [
      "/css/cssom/getComputedStyle-detached-subtree.html",
      {}
     ]
    ],
+   "css/cssom/getComputedStyle-display-none-001.html": [
+    [
+     "/css/cssom/getComputedStyle-display-none-001.html",
+     {}
+    ]
+   ],
+   "css/cssom/getComputedStyle-display-none-002.html": [
+    [
+     "/css/cssom/getComputedStyle-display-none-002.html",
+     {}
+    ]
+   ],
    "css/cssom/getComputedStyle-dynamic-subdoc.html": [
     [
      "/css/cssom/getComputedStyle-dynamic-subdoc.html",
      {}
     ]
    ],
    "css/cssom/getComputedStyle-pseudo.html": [
     [
@@ -547457,16 +547469,24 @@
   "css/cssom/font-shorthand-serialization.html": [
    "9d0bce1c0d74bf90aca1eb8ee6aa2e2ed2b92b30",
    "testharness"
   ],
   "css/cssom/getComputedStyle-detached-subtree.html": [
    "886f72b4eaa82d3aeb4de5c5b27f71369dbe0186",
    "testharness"
   ],
+  "css/cssom/getComputedStyle-display-none-001.html": [
+   "0e1f381bb67d045c9a92461f664c3c4d61de280f",
+   "testharness"
+  ],
+  "css/cssom/getComputedStyle-display-none-002.html": [
+   "2ffac7ef0de3a2b01217be7e2700660a4f9a5d0d",
+   "testharness"
+  ],
   "css/cssom/getComputedStyle-dynamic-subdoc.html": [
    "3f379487727d9730de9e3569b26632c35d602d9d",
    "testharness"
   ],
   "css/cssom/getComputedStyle-pseudo.html": [
    "d3ef09fb6092078562f8923879b9ece97938df47",
    "testharness"
   ],
@@ -548538,17 +548558,17 @@
    "cd3f0233cc0eaf9295e602ca25aef87fb68df851",
    "support"
   ],
   "css/mediaqueries/support/min-width-tables-001-iframe.html": [
    "29e7fb34c94e2e8411514d1e71d09aca2ddb642e",
    "support"
   ],
   "css/mediaqueries/test_media_queries.html": [
-   "cff3585932589f611a7101329d3b5b6ca27820aa",
+   "a7d78b13e119f8cd1ffa8812a9af67e59280084d",
    "testharness"
   ],
   "css/mediaqueries/viewport-script-dynamic-ref.html": [
    "7d55c513e2de39c9b362fc864233a3008ca6ced2",
    "support"
   ],
   "css/mediaqueries/viewport-script-dynamic.html": [
    "1c2ba1a9116942599804ed29553e85628afadb04",
@@ -619114,17 +619134,17 @@
    "5a31a3917a5157516c10951a3b3d5ffb43b992d9",
    "support"
   ],
   "webdriver/tests/support/asserts.py": [
    "b7424061b41d9bb1b87f147d5b29786695249d10",
    "support"
   ],
   "webdriver/tests/support/fixtures.py": [
-   "f1c704ea7b44e08dd63eaac6b5e9a3370e4c0503",
+   "5ae91067cee6f4cf7e3c63e99aca65104bbc2fab",
    "support"
   ],
   "webdriver/tests/support/http_request.py": [
    "cb40c781fea2280b98135522def5e6a116d7b946",
    "support"
   ],
   "webdriver/tests/support/inline.py": [
    "48399821b7abca50df824e37c41829d7a4573be1",
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/cssom/getComputedStyle-display-none-001.html.ini
@@ -0,0 +1,2 @@
+[getComputedStyle-display-none-001.html]
+  prefs: [dom.webcomponents.shadowdom.enabled:true]
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/cssom/getComputedStyle-display-none-001.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSSOM: getComputedStyle gets invalidated for display: none elements (inheritance)</title>
+<link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle">
+<link rel="help" href="https://bugs.webkit.org/show_bug.cgi?id=186882">
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<style>
+#undisplayed, #host {
+  display: none;
+  color: red;
+}
+</style>
+<div id="undisplayed"><div id="child"></div></div>
+<div id="host"></div>
+<script>
+  test(function() {
+    let undisplayed_style = getComputedStyle(undisplayed);
+    let undisplayed_child_style = getComputedStyle(child);
+    assert_equals(undisplayed_style.color, "rgb(255, 0, 0)");
+    assert_equals(undisplayed_child_style.color, "rgb(255, 0, 0)");
+    undisplayed.style.color = "green";
+    assert_equals(undisplayed_style.color, "rgb(0, 128, 0)");
+    assert_equals(undisplayed_child_style.color, "rgb(0, 128, 0)");
+  }, "getComputedStyle gets invalidated in display: none subtrees due to inherited changes to an ancestor");
+  test(function() {
+    host.attachShadow({ mode: 'open' }).innerHTML = `
+      <div></div>
+    `;
+    let host_style = getComputedStyle(host);
+    let shadow_style = getComputedStyle(host.shadowRoot.firstElementChild);
+    assert_equals(host_style.color, "rgb(255, 0, 0)");
+    assert_equals(shadow_style.color, "rgb(255, 0, 0)");
+    host.style.color = "green";
+    assert_equals(host_style.color, "rgb(0, 128, 0)");
+    assert_equals(shadow_style.color, "rgb(0, 128, 0)");
+  }, "getComputedStyle gets invalidated in display: none subtrees due to inherited changes to an ancestor shadow host");
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/cssom/getComputedStyle-display-none-002.html
@@ -0,0 +1,34 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSSOM: getComputedStyle gets invalidated for display: none elements (rules)</title>
+<link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle">
+<link rel="help" href="https://bugs.webkit.org/show_bug.cgi?id=186882">
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<style>
+#undisplayed {
+  display: none;
+  color: red;
+}
+.sibling + #undisplayed {
+  color: green;
+}
+
+.sibling + #undisplayed > div {
+  color: yellow;
+}
+</style>
+<div id="helper"></div>
+<div id="undisplayed"><div id="child"></div></div>
+<script>
+  test(function() {
+    let undisplayed_style = getComputedStyle(undisplayed);
+    let undisplayed_child_style = getComputedStyle(child);
+    assert_equals(undisplayed_style.color, "rgb(255, 0, 0)");
+    assert_equals(undisplayed_child_style.color, "rgb(255, 0, 0)");
+    helper.classList.add("sibling");
+    assert_equals(undisplayed_style.color, "rgb(0, 128, 0)");
+    assert_equals(undisplayed_child_style.color, "rgb(255, 255, 0)");
+  }, "getComputedStyle gets invalidated in display: none subtrees due to rule matching changes");
+</script>