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

Unified Diff: LayoutTests/fast/css/invalidation/targeted-class-host-pseudo.html

Issue 209333005: Support invalidation sets for :host pseudo. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed nit Created 6 years, 9 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
« no previous file with comments | « no previous file | LayoutTests/fast/css/invalidation/targeted-class-host-pseudo-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/css/invalidation/targeted-class-host-pseudo.html
diff --git a/LayoutTests/fast/css/invalidation/targeted-class-host-pseudo.html b/LayoutTests/fast/css/invalidation/targeted-class-host-pseudo.html
new file mode 100644
index 0000000000000000000000000000000000000000..6e28a856a3a9dfacd323829382833251de2571bf
--- /dev/null
+++ b/LayoutTests/fast/css/invalidation/targeted-class-host-pseudo.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<div id="host1"></div>
+<div id="host2"></div>
+<div id="host3" class="c3"></div>
+<div id="host4"></div>
+<script>
+description("Check that targeted class invalidation works with the :host pseudo class.");
+
+// Create shadow trees
+
+var host1 = document.getElementById("host1");
+host1.createShadowRoot().innerHTML = "<style>:host(.c1) { background-color: green }</style><div></div><div></div><div></div><div></div><div></div>";
+
+var host2 = document.getElementById("host2");
+host2.createShadowRoot().innerHTML = '<style>:host(.c2) .inner { background-color: green }</style><div></div><div></div><div></div><div><span id="inner" class="inner"></span></div>';
+
+var host3 = document.getElementById("host3");
+host3.createShadowRoot().innerHTML = "<style>:host(#host3:not(.c3)) { background-color: green }</style><div></div><div></div><div></div><div></div>";
+
+var host4 = document.getElementById("host4");
+host4.createShadowRoot().innerHTML = "<style>:host(.nomatch, .c4) { background-color: green }</style><div></div><div></div><div></div><div></div>";
+
+var transparent = "rgba(0, 0, 0, 0)";
+var green = "rgb(0, 128, 0)";
+
+var inner = host2.shadowRoot.getElementById("inner");
+
+shouldBe("getComputedStyle(host1, null).backgroundColor", "transparent");
+shouldBe("getComputedStyle(inner, null).backgroundColor", "transparent");
+shouldBe("getComputedStyle(host3, null).backgroundColor", "transparent");
+shouldBe("getComputedStyle(host4, null).backgroundColor", "transparent");
+
+document.body.offsetLeft; // force style recalc.
+
+host1.className = "c1";
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
+shouldBe("getComputedStyle(host1, null).backgroundColor", "green");
+
+document.body.offsetLeft; // force style recalc.
+
+host2.className = "c2";
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
+shouldBe("getComputedStyle(inner, null).backgroundColor", "green");
+
+document.body.offsetLeft; // force style recalc.
+
+host3.className = "";
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "6");
+shouldBe("getComputedStyle(host3, null).backgroundColor", "green");
+
+document.body.offsetLeft; // force style recalc.
+
+host4.className = "c4";
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
+shouldBe("getComputedStyle(host4, null).backgroundColor", "green");
+
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/css/invalidation/targeted-class-host-pseudo-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698