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

Unified Diff: LayoutTests/fast/css/hover-recalc.html

Issue 229413006: Don't recalculate style synchronously on hover/active. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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/hover-recalc-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/css/hover-recalc.html
diff --git a/LayoutTests/fast/css/hover-recalc.html b/LayoutTests/fast/css/hover-recalc.html
new file mode 100644
index 0000000000000000000000000000000000000000..67355b70000de706c7435fd4748825d634b2a8bd
--- /dev/null
+++ b/LayoutTests/fast/css/hover-recalc.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<style>
+.test { width: 100px; height: 100px }
+.test:hover { background-color: green }
+.over { width: 150px }
+</style>
+<div id="t1" class="test"></div>
+<div id="t2" class="test"><div></div></div>
+<div id="t3" class="test" onmouseover="this.firstChild.className='over'"><div></div></div>
+<script>
+description("Check that mousemove does not recalc style synchronously.");
+
+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");
+
+shouldBe("getComputedStyle(t1, null).backgroundColor", "transparent");
+shouldBe("getComputedStyle(t2, null).backgroundColor", "transparent");
+
+var x1 = t1.offsetLeft + 1;
+var y1 = t1.offsetTop + 1;
+
+eventSender.mouseMoveTo(x1, y1);
+shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
+shouldBe("getComputedStyle(t1, null).backgroundColor", "green");
+
+var x2 = t2.offsetLeft + 1;
+var y2 = t2.offsetTop + 1;
+
+eventSender.mouseMoveTo(0, 0);
+eventSender.mouseMoveTo(x2, y2);
+t2.firstChild.className = "over";
+shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
+shouldBe("getComputedStyle(t2, null).backgroundColor", "green");
+shouldBe("getComputedStyle(t2.firstChild, null).width", "'150px'");
+
+var x3 = t3.offsetLeft + 1;
+var y3 = t3.offsetTop + 1;
+eventSender.mouseMoveTo(0, 0);
+eventSender.mouseMoveTo(x3, y3);
+shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");
+shouldBe("getComputedStyle(t3, null).backgroundColor", "green");
+shouldBe("getComputedStyle(t3.firstChild, null).width", "'150px'");
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/css/hover-recalc-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698