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

Unified Diff: LayoutTests/fast/css/invalidation/targeted-hover-invalidation.html

Issue 220943002: Use invalidation sets for :hover, :active, and :focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove unnecessary seenCombinator handling. Created 6 years, 8 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-hover-invalidation-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-hover-invalidation.html
diff --git a/LayoutTests/fast/css/invalidation/targeted-hover-invalidation.html b/LayoutTests/fast/css/invalidation/targeted-hover-invalidation.html
new file mode 100644
index 0000000000000000000000000000000000000000..f6e290a909f5e3b2864293bca96c96caeb32ec1f
--- /dev/null
+++ b/LayoutTests/fast/css/invalidation/targeted-hover-invalidation.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<style>
+.test { width: 50px; height: 50px; }
+#t1:hover { background-color: green }
+#t2:hover .class { background-color: green }
+#t3:hover span { background-color: green }
+</style>
+<div id="t1" class="test">
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+</div>
+<div id="t2" class="test">
+ <div></div>
+ <div></div>
+ <div class="class"></div>
+ <div></div>
+</div>
+<div id="t3" class="test">
+ <div></div>
+ <div></div>
+ <div><span></span></div>
+ <div><span></span></div>
+</div>
+<script>
+description("Check that invalidation sets work for :hover changes.");
+
+function hoverElement(element) {
+ eventSender.mouseMoveTo(0, 0);
+ document.body.offsetLeft; // force recalc.
+ var x = element.offsetLeft + 1;
+ var y = element.offsetTop + 1;
+ eventSender.mouseMoveTo(x, y);
+}
+
+shouldBeDefined("window.internals");
+shouldBeDefined("window.eventSender");
+
+var transparent = "rgba(0, 0, 0, 0)";
+var green = "rgb(0, 128, 0)";
+
+var t1 = document.getElementById("t1");
+var t2 = document.getElementById("t2");
+var t3 = document.getElementById("t3");
+
+var r1 = t1;
+var r2 = t2.querySelector(".class");
+var r3 = t3.querySelectorAll("span");
+
+shouldBe("getComputedStyle(r1, null).backgroundColor", "transparent");
+shouldBe("getComputedStyle(r2, null).backgroundColor", "transparent");
+shouldBe("r3.length", "2");
+shouldBe("getComputedStyle(r3[0], null).backgroundColor", "transparent");
+shouldBe("getComputedStyle(r3[1], null).backgroundColor", "transparent");
+
+hoverElement(t1);
+shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
+shouldBe("getComputedStyle(r1, null).backgroundColor", "green");
+
+hoverElement(t2);
+shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
+shouldBe("getComputedStyle(r2, null).backgroundColor", "green");
+
+hoverElement(t3);
+shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "3");
+shouldBe("getComputedStyle(r3[0], null).backgroundColor", "green");
+shouldBe("getComputedStyle(r3[1], null).backgroundColor", "green");
+
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/css/invalidation/targeted-hover-invalidation-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698