Bug 1412251: Make style sharing look at XBL / Shadow DOM rules. r?bz
MozReview-Commit-ID: II6lk6OmSZU
--- 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>