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

Unified Diff: LayoutTests/fast/dom/hover-after-dom-delete-child-invisible-cursor.html

Issue 16285002: Do not invoke or clear hover effects on node deletion when cursor is invisible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 7 years, 6 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/dom/hover-after-dom-delete-child-invisible-cursor.html
diff --git a/LayoutTests/fast/dom/hover-after-dom-delete-child-invisible-cursor.html b/LayoutTests/fast/dom/hover-after-dom-delete-child-invisible-cursor.html
new file mode 100644
index 0000000000000000000000000000000000000000..0599af101963d80f467ceb397534709e3e4d3677
--- /dev/null
+++ b/LayoutTests/fast/dom/hover-after-dom-delete-child-invisible-cursor.html
@@ -0,0 +1,94 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+#red {
+ background-color: red;
+ position: absolute;
+ left: 50px;
+ top: 50px;
+ height: 100px;
+ width: 100px;
+}
+#red:hover::after {
+ content: "Hovered.";
+}
+
+#blue {
+ background-color: blue;
+ position: absolute;
+ left: 50px;
+ top: 50px;
+ height: 100px;
+ width: 100px;
+}
+#blue:hover::after {
+ content: "Hovered.";
+}
+
+</style>
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body onload="runtest()" style="margin:0">
+
+<script type="text/javascript">
+var redDiv;
+var blueText;
+var redText;
+var hoveredText = "'Hovered.'";
+function runtest()
+{
+ if (!window.testRunner || !window.eventSender)
+ return;
+
+ if (!window.internals || !window.internals.setIsCursorVisible) {
+ debug("window.internals.setIsCursorVisible is required to run this test.");
+ return;
+ }
+
+ testRunner.waitUntilDone();
+
+ redDiv = document.getElementById('red');
+
+ document.addEventListener('keydown', function(e) {
+ redDiv.parentNode.removeChild(redDiv);
+ });
+
+ debug("Mouse is visible, moving it over the red div.");
+ internals.setIsCursorVisible(document, true);
+ eventSender.mouseMoveTo(175, 175);
+ blueText = window.getComputedStyle(document.querySelector('#blue'), ':after').content;
+ redText = window.getComputedStyle(document.querySelector('#red'), ':after').content;
+ shouldBeEqualToString("blueText", hoveredText);
+ shouldBeEqualToString("redText", hoveredText);
+
+ debug("Setting mouse cursor to be invisible.");
+ internals.setIsCursorVisible(document, false);
+ blueText = window.getComputedStyle(document.querySelector('#blue'), ':after').content;
+ redText = window.getComputedStyle(document.querySelector('#red'), ':after').content;
+ shouldBeEqualToString("blueText", hoveredText);
+ shouldBeEqualToString("redText", hoveredText);
+
+ debug("Deleting red div.");
+ eventSender.keyDown("a");
+ window.setTimeout(testAfterDelete, 0);
+}
+
+function testAfterDelete()
+{
+ blueText = window.getComputedStyle(document.querySelector('#blue'), ':after').content;
+ shouldBeEqualToString("blueText", hoveredText);
+ testRunner.notifyDone();
+}
+
+</script>
+
+<div id="blue">
+ <div id="red"></div>
+</div>
+
+<p>Test for <a href="http://crbug.com/240722">http://crbug.com/240722</a>. If the mouse cursor is not visible, existing hover effects on a parent should be preserved if the child is the currently hovered element and is removed from the DOM. Press any key to delete the red div.</p>
+
+<div id="console"></div>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698