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

Unified Diff: LayoutTests/fast/css/invalidation/targeted-class-type-selectors.html

Issue 222643002: Support tag names as invalidation set features. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. 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
Index: LayoutTests/fast/css/invalidation/targeted-class-type-selectors.html
diff --git a/LayoutTests/fast/css/invalidation/targeted-class-type-selectors.html b/LayoutTests/fast/css/invalidation/targeted-class-type-selectors.html
new file mode 100644
index 0000000000000000000000000000000000000000..b9202a30025f898011fe86b6d22b25a56c7f1b6d
--- /dev/null
+++ b/LayoutTests/fast/css/invalidation/targeted-class-type-selectors.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<style>
+.a1 span { background-color: green }
+.a2 span + div { background-color: green }
+.a3 * { background-color: green }
+</style>
+<div id="t1">
+ <span></span>
+ <span></span>
+ <div></div>
+ <div></div>
+</div>
+<div id="t2">
+ <span></span>
+ <span></span>
+ <div></div>
+ <div></div>
+</div>
+<div id="t3">
+ <span></span>
+ <span></span>
+ <span></span>
+ <span></span>
+</div>
+<script>
+description("Check that targeted class invalidation works for type selectors.");
+
+var transparent = "rgba(0, 0, 0, 0)";
+var green = "rgb(0, 128, 0)";
+
+var children = [
+ document.querySelectorAll("#t1 *"),
+ document.querySelectorAll("#t2 *"),
+ document.querySelectorAll("#t3 *")
+];
+
+document.body.offsetTop; // Force style recalc.
+
+for (var i=0; i<children.length; i++) {
+ for (var j=0; j<children[i].length; j++) {
+ var evalString = "getComputedStyle(children["+i+"]["+j+"], null).backgroundColor";
+ shouldBe(evalString, "transparent");
+ }
+}
+
+document.body.offsetTop; // Force style recalc.
+
+document.getElementById("t1").className = "a1";
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "3");
+shouldBe("getComputedStyle(children[0][0], null).backgroundColor", "green");
+shouldBe("getComputedStyle(children[0][1], null).backgroundColor", "green");
+shouldBe("getComputedStyle(children[0][2], null).backgroundColor", "transparent");
+shouldBe("getComputedStyle(children[0][3], null).backgroundColor", "transparent");
+
+document.body.offsetLeft; // force style recalc.
+
+document.getElementById("t2").className = "a2";
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "5");
+shouldBe("getComputedStyle(children[1][0], null).backgroundColor", "transparent");
+shouldBe("getComputedStyle(children[1][1], null).backgroundColor", "transparent");
+shouldBe("getComputedStyle(children[1][2], null).backgroundColor", "green");
+shouldBe("getComputedStyle(children[1][3], null).backgroundColor", "transparent");
+
+document.body.offsetLeft; // force style recalc.
+
+document.getElementById("t3").className = "a3";
+if (window.internals)
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "5");
+shouldBe("getComputedStyle(children[2][0], null).backgroundColor", "green");
+shouldBe("getComputedStyle(children[2][1], null).backgroundColor", "green");
+shouldBe("getComputedStyle(children[2][2], null).backgroundColor", "green");
+shouldBe("getComputedStyle(children[2][3], null).backgroundColor", "green");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698