LayoutTests:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Mar 2006 16:35:57 +0000 (16:35 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Mar 2006 16:35:57 +0000 (16:35 +0000)
        Reviewed by Darin.

        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=7583
          DRT hangs when doing eventSender.mouseDown on native widgets

        * fast/events/event-sender-mouse-click-expected.txt: Added.
        * fast/events/event-sender-mouse-click.html: Added.

WebKitTools:

        Test: fast/events/event-sender-mouse-click.html

        Reviewed by Darin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7583
          DRT hangs when doing eventSender.mouseDown on native widgets

        * DumpRenderTree/DumpRenderTree.m:
        (+[EventSendingController isSelectorExcludedFromWebScript:]):
        (-[EventSendingController mouseClick]): Simulates a click in a native
        widget by queueing a mouseUp before sending the mouseDown, so that
        the widget's mouse tracking event loop doesn't hang indefinitely.

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

LayoutTests/ChangeLog
LayoutTests/fast/events/event-sender-mouse-click-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/event-sender-mouse-click.html [new file with mode: 0644]
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.m

index 80a924d0b72ac0cd401343a4c8be0c643a21b11a..7bb451dedfb959ebc7d600d92760f9449893df5f 100644 (file)
@@ -1,3 +1,13 @@
+2006-03-09  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Darin.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=7583
+          DRT hangs when doing eventSender.mouseDown on native widgets
+
+        * fast/events/event-sender-mouse-click-expected.txt: Added.
+        * fast/events/event-sender-mouse-click.html: Added.
+
 2006-03-09  David Carson  <dacarson@gmail.com>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/events/event-sender-mouse-click-expected.txt b/LayoutTests/fast/events/event-sender-mouse-click-expected.txt
new file mode 100644 (file)
index 0000000..114d6b8
--- /dev/null
@@ -0,0 +1,6 @@
+
+Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=7583 DRT hangs when doing eventSender.mouseDown on native widgets. This tests eventSender.mouseClick().
+
+Test result: PASS.
+
+
diff --git a/LayoutTests/fast/events/event-sender-mouse-click.html b/LayoutTests/fast/events/event-sender-mouse-click.html
new file mode 100644 (file)
index 0000000..910bfe2
--- /dev/null
@@ -0,0 +1,20 @@
+<script>
+var clicked = false;
+</script>
+<input type="text" onfocus="clicked = true;">
+<p>
+    Test for <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7583">http://bugzilla.opendarwin.org/show_bug.cgi?id=7583</a>
+    DRT hangs when doing eventSender.mouseDown on native widgets</i>. This tests eventSender.mouseClick().
+</p>
+<hr>
+<p>
+    Test result: <span id="result">(cannot run interactively)</span>.
+</p>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    eventSender.mouseMoveTo(20, 20);
+    eventSender.mouseClick();
+    document.getElementById('result').innerText = clicked ? 'PASS' : 'FAIL';
+}
+</script>
index 31159bd1da3de29c931c5036d39813e64abae4b1..9b80e4e8649c878686efa77d97296e5f8172127b 100644 (file)
@@ -1,3 +1,18 @@
+2006-03-09  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Test: fast/events/event-sender-mouse-click.html
+
+        Reviewed by Darin.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7583
+          DRT hangs when doing eventSender.mouseDown on native widgets
+
+        * DumpRenderTree/DumpRenderTree.m:
+        (+[EventSendingController isSelectorExcludedFromWebScript:]):
+        (-[EventSendingController mouseClick]): Simulates a click in a native
+        widget by queueing a mouseUp before sending the mouseDown, so that
+        the widget's mouse tracking event loop doesn't hang indefinitely.
+
 2006-03-09  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Eric.
index 4463d69f9973e953c28ea8b7bc41f019e9ad97a0..c306dfd4173631a6c16348aa16b601f39039f388 100644 (file)
@@ -689,6 +689,7 @@ static void dump(void)
 {
     if (aSelector == @selector(mouseDown)
             || aSelector == @selector(mouseUp)
+            || aSelector == @selector(mouseClick)
             || aSelector == @selector(mouseMoveToX:Y:)
             || aSelector == @selector(leapForward:))
         return NO;
@@ -804,6 +805,40 @@ static void dump(void)
     }
 }
 
+- (void)mouseClick
+{
+    [[[frame frameView] documentView] layout];
+    if ([self currentEventTime] - lastClick >= 1)
+        clickCount = 1;
+    else
+        clickCount++;
+    NSEvent *mouseDownEvent = [NSEvent mouseEventWithType:NSLeftMouseDown 
+                                        location:lastMousePosition 
+                                   modifierFlags:nil 
+                                       timestamp:[self currentEventTime]
+                                    windowNumber:[[[frame webView] window] windowNumber] 
+                                         context:[NSGraphicsContext currentContext] 
+                                     eventNumber:++eventNumber 
+                                      clickCount:clickCount 
+                                        pressure:nil];
+
+    NSView *subView = [[frame webView] hitTest:[mouseDownEvent locationInWindow]];
+    if (subView) {
+        [self leapForward:1];
+        NSEvent *mouseUpEvent = [NSEvent mouseEventWithType:NSLeftMouseUp
+                                                   location:lastMousePosition
+                                              modifierFlags:nil
+                                                  timestamp:[self currentEventTime]
+                                               windowNumber:[[[frame webView] window] windowNumber]
+                                                    context:[NSGraphicsContext currentContext]
+                                                eventNumber:++eventNumber
+                                                 clickCount:clickCount
+                                                   pressure:nil];
+        [NSApp postEvent:mouseUpEvent atStart:NO];
+        [subView mouseDown:mouseDownEvent];
+    }
+}
+
 @end
 
 static void dumpRenderTree(const char *pathOrURL)