Bug 1412251: Make style sharing look at XBL / Shadow DOM rules. r?bz draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 28 Oct 2017 01:48:08 +0200
changeset 688052 d9934eeede358979dbcfb01ede044b560ba0379e
parent 688051 88621f3105fc980292bd7f3060cc81ba37174d47
child 737781 a7720ee18c0ccd1b60412a1d7b31811919494e5e
push id86651
push userbmo:emilio@crisal.io
push dateSat, 28 Oct 2017 01:47:55 +0000
reviewersbz
bugs1412251
milestone58.0a1
Bug 1412251: Make style sharing look at XBL / Shadow DOM rules. r?bz MozReview-Commit-ID: II6lk6OmSZU
layout/reftests/webcomponents/reftest.list
layout/reftests/webcomponents/style-sharing-across-shadow.html
layout/reftests/webcomponents/style-sharing-ref.html
layout/reftests/webcomponents/style-sharing.html
--- a/layout/reftests/webcomponents/reftest.list
+++ b/layout/reftests/webcomponents/reftest.list
@@ -10,8 +10,10 @@ pref(dom.webcomponents.enabled,true) == 
 pref(dom.webcomponents.enabled,true) == nested-insertion-point-1.html nested-insertion-point-1-ref.html
 pref(dom.webcomponents.enabled,true) == update-dist-node-descendants-1.html update-dist-node-descendants-1-ref.html
 pref(dom.webcomponents.enabled,true) fuzzy-if(Android,2,7) == input-transition-1.html input-transition-1-ref.html
 pref(dom.webcomponents.enabled,true) == dynamic-insertion-point-distribution-1.html dynamic-insertion-point-distribution-1-ref.html
 pref(dom.webcomponents.enabled,true) == dynamic-insertion-point-distribution-2.html dynamic-insertion-point-distribution-2-ref.html
 pref(dom.webcomponents.enabled,true) == remove-append-shadow-host-1.html remove-append-shadow-host-1-ref.html
 pref(dom.webcomponents.enabled,true) == reframe-shadow-child-1.html reframe-shadow-child-ref.html
 pref(dom.webcomponents.enabled,true) == reframe-shadow-child-2.html reframe-shadow-child-ref.html
+pref(dom.webcomponents.enabled,true) == style-sharing.html style-sharing-ref.html
+pref(dom.webcomponents.enabled,true) skip-if(!stylo||styloVsGecko) == style-sharing-across-shadow.html style-sharing-ref.html # bug 1412400
new file mode 100644
--- /dev/null
+++ b/layout/reftests/webcomponents/style-sharing-across-shadow.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<style>
+  div { display: contents }
+</style>
+<div></div>
+<div></div>
+<script>
+  let divs = document.querySelectorAll('div');
+  divs[0].createShadowRoot().innerHTML = `
+    <style>
+      * { color: green; }
+    </style>
+    <span>Should be green</span>
+  `;
+  divs[1].createShadowRoot().innerHTML = `
+    <style>
+      * { color: initial; }
+      [foo] { }
+    </style>
+    <span>Should not be green</span>
+  `;
+</script>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/webcomponents/style-sharing-ref.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<div>
+  <span style="color: green">Should be green</span>
+  <span>Should not be green</span>
+</div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/webcomponents/style-sharing.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<div id="host"></div>
+<script>
+  let root = host.createShadowRoot();
+  root.innerHTML = `
+    <style>
+      #test {
+        color: green;
+      }
+    </style>
+    <span id="test">Should be green</span>
+    <span id="test2">Should not be green</span>
+  `;
+</script>