Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: LayoutTests/fast/css/invalidation/shadow-add-sheet-host.html

Issue 1311463004: Invalidate style from shadow host, not root, to apply :host rules. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/css/invalidation/shadow-add-sheet-host.html
diff --git a/LayoutTests/fast/css/invalidation/shadow-add-sheet-host.html b/LayoutTests/fast/css/invalidation/shadow-add-sheet-host.html
new file mode 100644
index 0000000000000000000000000000000000000000..5852e0d86f505cefb9efa3d5cd9727e858958a6b
--- /dev/null
+++ b/LayoutTests/fast/css/invalidation/shadow-add-sheet-host.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<style>
+ #outerHost { color: red }
+</style>
+<div>
+ <div id="outerHost"></div>
+ <div></div>
+ <div></div>
+</div>
+<script>
+ description("Insert a style element into a shadow tree affecting the host.");
+
+ var outerRoot = outerHost.createShadowRoot();
+ outerRoot.innerHTML = "<div><div id='host1'></div></div><div></div>";
+
+ var host1 = outerRoot.querySelector("#host1");
+ var root1 = host1.createShadowRoot();
+ root1.innerHTML = "<div><div id='host2'></div></div><div></div>";
+
+ var host2 = root1.querySelector("#host2");
+ var root2 = host2.createShadowRoot();
+ root2.innerHTML = "This text should be green";
+
+ shouldBeEqualToString("getComputedStyle(host2).color", "rgb(255, 0, 0)");
+
+ document.body.offsetTop;
+ var sheet = document.createElement("style");
+ sheet.appendChild(document.createTextNode(":host { color: green }"));
+ root2.appendChild(sheet);
+
+ if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
+
+ shouldBeEqualToString("getComputedStyle(host2).color", "rgb(0, 128, 0)");
+</script>

Powered by Google App Engine
This is Rietveld 408576698