Title: [155348] trunk
Revision
155348
Author
[email protected]
Date
2013-09-09 06:58:13 -0700 (Mon, 09 Sep 2013)

Log Message

MouseLeave not always emitted when cursor leaves subframe
https://bugs.webkit.org/show_bug.cgi?id=121026

Reviewed by Antonio Gomes.

Source/WebCore:

Forward the PlatformMouseEvent in the recursive calls so nested documents
also get a chance to emit mouseleave when the hover moves out.

Test: fast/events/mouseenterleave-on-subframe.html

* dom/Document.cpp:
(WebCore::Document::updateHoverActiveState):

LayoutTests:

Test or mouseenter/mouseleave events in an inner document. Note this test also
tests bug 120862, but the initial expectations assume that part to fail.

* fast/events/mouseenterleave-on-subframe-expected.html: Added.
* fast/events/mouseenterleave-on-subframe.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (155347 => 155348)


--- trunk/LayoutTests/ChangeLog	2013-09-09 13:49:33 UTC (rev 155347)
+++ trunk/LayoutTests/ChangeLog	2013-09-09 13:58:13 UTC (rev 155348)
@@ -1,3 +1,16 @@
+2013-09-09  Allan Sandfeld Jensen  <[email protected]>
+
+        MouseLeave not always emitted when cursor leaves subframe
+        https://bugs.webkit.org/show_bug.cgi?id=121026
+
+        Reviewed by Antonio Gomes.
+
+        Test or mouseenter/mouseleave events in an inner document. Note this test also
+        tests bug 120862, but the initial expectations assume that part to fail.
+
+        * fast/events/mouseenterleave-on-subframe-expected.html: Added.
+        * fast/events/mouseenterleave-on-subframe.html: Added.
+
 2013-09-09  Krzysztof Czech  <[email protected]>
 
         [EFL] Added new expected results after r153435

Added: trunk/LayoutTests/fast/events/mouseenterleave-on-subframe-expected.html (0 => 155348)


--- trunk/LayoutTests/fast/events/mouseenterleave-on-subframe-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/mouseenterleave-on-subframe-expected.html	2013-09-09 13:58:13 UTC (rev 155348)
@@ -0,0 +1,12 @@
+
+This is a test of a mouseleave events in an inner-document. The test is success if we get matching mouseleave events for every mouseenter event.
+
+mouseenter on DIV
+mouseenter on BODY
+mouseenter on HTML
+mouseenter on #document
+mouseleave on DIV
+mouseleave on BODY
+mouseleave on HTML
+mouseleave on #document
+

Added: trunk/LayoutTests/fast/events/mouseenterleave-on-subframe.html (0 => 155348)


--- trunk/LayoutTests/fast/events/mouseenterleave-on-subframe.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/mouseenterleave-on-subframe.html	2013-09-09 13:58:13 UTC (rev 155348)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function log(message) {
+    document.getElementById('console').innerHTML += (message + "\n");
+}
+
+function logMouseEvent(ev) {
+    var target = (ev.target)? ev.target : ev.srcElement;
+    log(ev.type + " on " + target.nodeName);
+}
+
+function doTest() {
+    document.body.offsetLeft;
+    var innerDocument = window.frames[0].document;
+    innerDocument.addEventListener('mouseenter', logMouseEvent, true);
+    innerDocument.addEventListener('mouseleave', logMouseEvent, true);
+    if (window.testRunner) {
+        eventSender.mouseMoveTo(50, 50);
+        eventSender.mouseMoveTo(200, 200);
+        testRunner.dumpAsText();
+    }
+}
+</script>
+</head>
+<body _onload_="doTest()">
+<iframe id="iframe1" style="width:120px; height:120px;" src="" style='width:100px; height:100px'></div>"></iframe>
+<p>This is a test of a mouseleave events in an inner-document. The test is success if we get matching mouseleave events for every mouseenter event, and if the logged nodeNames of event targets does not
+include '#document'.
+<pre id="console"></pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (155347 => 155348)


--- trunk/Source/WebCore/ChangeLog	2013-09-09 13:49:33 UTC (rev 155347)
+++ trunk/Source/WebCore/ChangeLog	2013-09-09 13:58:13 UTC (rev 155348)
@@ -1,3 +1,18 @@
+2013-09-09  Allan Sandfeld Jensen  <[email protected]>
+
+        MouseLeave not always emitted when cursor leaves subframe
+        https://bugs.webkit.org/show_bug.cgi?id=121026
+
+        Reviewed by Antonio Gomes.
+
+        Forward the PlatformMouseEvent in the recursive calls so nested documents
+        also get a chance to emit mouseleave when the hover moves out.
+
+        Test: fast/events/mouseenterleave-on-subframe.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateHoverActiveState):
+
 2013-09-09  Thiago de Barros Lacerda  <[email protected]>
 
         Adding username to RTCIceServer

Modified: trunk/Source/WebCore/dom/Document.cpp (155347 => 155348)


--- trunk/Source/WebCore/dom/Document.cpp	2013-09-09 13:49:33 UTC (rev 155347)
+++ trunk/Source/WebCore/dom/Document.cpp	2013-09-09 13:58:13 UTC (rev 155348)
@@ -5759,7 +5759,7 @@
 
     Element* innerElementInDocument = innerElement;
     while (innerElementInDocument && &innerElementInDocument->document() != this) {
-        innerElementInDocument->document().updateHoverActiveState(request, innerElementInDocument);
+        innerElementInDocument->document().updateHoverActiveState(request, innerElementInDocument, event);
         innerElementInDocument = innerElementInDocument->document().ownerElement();
     }
 
@@ -5863,7 +5863,7 @@
         // Unset hovered nodes in sub frame documents if the old hovered node was a frame owner.
         if (oldHoveredElement && oldHoveredElement->isFrameOwnerElement()) {
             if (Document* contentDocument = toFrameOwnerElement(oldHoveredElement.get())->contentDocument())
-                contentDocument->updateHoverActiveState(request, 0);
+                contentDocument->updateHoverActiveState(request, 0, event);
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to