LayoutTests:
authorantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Feb 2007 23:13:26 +0000 (23:13 +0000)
committerantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Feb 2007 23:13:26 +0000 (23:13 +0000)
        Reviewed by Hyatt.

        - test for http://bugs.webkit.org/show_bug.cgi?id=12918
        REGRESSION: Google Finance dropdown Flickers
        <rdar://4988039>

        * fast/events/mouseout-dead-node-expected.checksum: Added.
        * fast/events/mouseout-dead-node-expected.png: Added.
        * fast/events/mouseout-dead-node-expected.txt: Added.
        * fast/events/mouseout-dead-node.html: Added.

WebCore:

        Reviewed by Hyatt.

        - fix http://bugs.webkit.org/show_bug.cgi?id=12918
        REGRESSION: Google Finance dropdown Flickers
        <rdar://4988039>

        If a node dies while mouse is over it, it is still supposed to receive
        mouseout event (wasn't case in Tiger webkit). However this event should
        not propagate to any other nodes. This patch matches Firefox behavior in
        this respect.

        * dom/EventTargetNode.cpp:
        (WebCore::EventTargetNode::dispatchGenericEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@19897 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/events/mouseout-dead-node-expected.checksum [new file with mode: 0644]
LayoutTests/fast/events/mouseout-dead-node-expected.png [new file with mode: 0644]
LayoutTests/fast/events/mouseout-dead-node-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/mouseout-dead-node.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/dom/EventTargetNode.cpp

index 5b0c4eef4762636259cf39482aa6d9b4d55d7b05..b0b519305d94bffa52d207d7f1da39469f80854d 100644 (file)
@@ -1,3 +1,16 @@
+2007-02-27  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Hyatt.
+        
+        - test for http://bugs.webkit.org/show_bug.cgi?id=12918
+        REGRESSION: Google Finance dropdown Flickers
+        <rdar://4988039>
+
+        * fast/events/mouseout-dead-node-expected.checksum: Added.
+        * fast/events/mouseout-dead-node-expected.png: Added.
+        * fast/events/mouseout-dead-node-expected.txt: Added.
+        * fast/events/mouseout-dead-node.html: Added.
+
 2007-02-27  Geoffrey Garen  <ggaren@apple.com>
 
         Bumped up the wiggle room on this test because it's failing on the buildbot.
diff --git a/LayoutTests/fast/events/mouseout-dead-node-expected.checksum b/LayoutTests/fast/events/mouseout-dead-node-expected.checksum
new file mode 100644 (file)
index 0000000..0bb70a1
--- /dev/null
@@ -0,0 +1 @@
+4219b39feae5b4eac4fdf17c4d07f378
\ No newline at end of file
diff --git a/LayoutTests/fast/events/mouseout-dead-node-expected.png b/LayoutTests/fast/events/mouseout-dead-node-expected.png
new file mode 100644 (file)
index 0000000..9b8d132
Binary files /dev/null and b/LayoutTests/fast/events/mouseout-dead-node-expected.png differ
diff --git a/LayoutTests/fast/events/mouseout-dead-node-expected.txt b/LayoutTests/fast/events/mouseout-dead-node-expected.txt
new file mode 100644 (file)
index 0000000..82fa2f2
--- /dev/null
@@ -0,0 +1,22 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 625x18
+          text run at (0,0) width 625: "Test that if node dies under mouse it receives mouseout event but that the event does not propagate."
+      RenderBlock {DIV} at (0,18) size 784x22 [border: (2px solid #FF0000)]
+        RenderBlock (anonymous) at (2,2) size 780x18
+          RenderText {#text} at (0,0) size 180x18
+            text run at (0,0) width 180: "you should see PASS below"
+      RenderBlock {DIV} at (0,40) size 784x22 [border: (2px solid #0000FF)]
+        RenderBlock (anonymous) at (2,2) size 780x18
+          RenderText {#text} at (0,0) size 180x18
+            text run at (0,0) width 180: "you should see PASS below"
+      RenderBlock {DIV} at (0,62) size 784x18
+        RenderText {#text} at (0,0) size 104x18
+          text run at (0,0) width 104: "mouseout PASS"
+      RenderBlock {DIV} at (0,80) size 784x18
+        RenderText {#text} at (0,0) size 104x18
+          text run at (0,0) width 104: "mouseout PASS"
diff --git a/LayoutTests/fast/events/mouseout-dead-node.html b/LayoutTests/fast/events/mouseout-dead-node.html
new file mode 100644 (file)
index 0000000..93769c7
--- /dev/null
@@ -0,0 +1,40 @@
+<body onload='test()'>
+Test that if node dies under mouse it receives mouseout event but that the event does not propagate.
+<div id=d0 style='border:2px solid red'>
+    <div onmouseout='out("FAIL")'  onmouseover='document.getElementById("d0").innerHTML ="you should see PASS below"'>
+        <div onmouseout='out("FAIL")'>
+            <span id=target1 onmouseout='out("PASS")' >
+                mouse over me
+            </span>
+        </div>
+    </div>
+</div>
+<div id=d1 style='border:2px solid blue'>
+    <div id=target2 onmouseout='out("PASS")'  onmouseover='document.getElementById("d1").innerHTML ="you should see PASS below"' >
+        mouse over me
+    </div>
+</div>
+<script>
+function out(a)
+{   
+    var xx = document.createElement("DIV");
+    xx.innerHTML = 'mouseout '+a;
+    document.body.appendChild(xx);
+}
+
+function test() {
+    if (window.eventSender) {
+        var el = document.getElementById('target1');
+        var x = el.offsetLeft+3;
+        var y = el.offsetTop+3;
+        eventSender.mouseMoveTo(x, y); 
+        eventSender.mouseUp();
+        el = document.getElementById('target2');
+        x = el.offsetLeft+3;
+        y = el.offsetTop+3;
+        eventSender.mouseMoveTo(x, y);
+        eventSender.mouseUp();
+
+    }
+}
+</script>
index 90c13067ae66e87c8d47aa6a325bf0b63703f08f..73e816dbaeeb2be9f79fbff46d52929a3ac6ab4f 100644 (file)
@@ -1,3 +1,19 @@
+2007-02-27  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Hyatt.
+        
+        - fix http://bugs.webkit.org/show_bug.cgi?id=12918
+        REGRESSION: Google Finance dropdown Flickers
+        <rdar://4988039>
+        
+        If a node dies while mouse is over it, it is still supposed to receive
+        mouseout event (wasn't case in Tiger webkit). However this event should 
+        not propagate to any other nodes. This patch matches Firefox behavior in
+        this respect.
+
+        * dom/EventTargetNode.cpp:
+        (WebCore::EventTargetNode::dispatchGenericEvent):
+
 2007-02-27  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Maciej Stachowiak.
index e1f7814ca37dfe45f2198f233bb8cfa76c15e3cb..3ccefed7e6708d451ee3b1b3cec5b8dab5b2f35f 100644 (file)
@@ -177,11 +177,16 @@ bool EventTargetNode::dispatchGenericEvent(PassRefPtr<Event> e, ExceptionCode&,
     
     // work out what nodes to send event to
     DeprecatedPtrList<Node> nodeChain;
-    Node *n;
-
-    for (n = this; n; n = n->eventParentNode()) {
-        n->ref();
-        nodeChain.prepend(n);
+    
+    if (inDocument()) {
+        for (Node* n = this; n; n = n->eventParentNode()) {
+            n->ref();
+            nodeChain.prepend(n);
+        } 
+    } else {
+        // if node is not in the document just send event to itself 
+        ref();
+        nodeChain.prepend(this);
     }
     
     DeprecatedPtrListIterator<Node> it(nodeChain);