Reviewed by Darin.
authorkdecker@apple.com <kdecker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Dec 2007 18:47:39 +0000 (18:47 +0000)
committerkdecker@apple.com <kdecker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Dec 2007 18:47:39 +0000 (18:47 +0000)
        Fixed: <rdar://problem/4290098> Right-mouse click on element doesn't call onmousedown handler

        * WebView/WebHTMLView.mm:
        (-[WebHTMLView menuForEvent:]): Match behavior of other browsers by sending an onmousedown event for right clicks.

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

LayoutTests/fast/events/context-onmousedown-event-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/context-onmousedown-event.html [new file with mode: 0644]
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebHTMLView.mm

diff --git a/LayoutTests/fast/events/context-onmousedown-event-expected.txt b/LayoutTests/fast/events/context-onmousedown-event-expected.txt
new file mode 100644 (file)
index 0000000..2c8b755
--- /dev/null
@@ -0,0 +1,2 @@
+This tests to make sure that right clicking also sends a onmousedown event.
+PASS
diff --git a/LayoutTests/fast/events/context-onmousedown-event.html b/LayoutTests/fast/events/context-onmousedown-event.html
new file mode 100644 (file)
index 0000000..365fbe0
--- /dev/null
@@ -0,0 +1,20 @@
+<html>
+<body>
+<div id="box" onmousedown="document.getElementById('result').appendChild(document.createTextNode('PASS'));" style="border:1px dotted red">This tests to make sure that right clicking also sends a onmousedown event.</div>
+<p id='result'></p>
+</body>
+</html>
+
+
+<script>
+if (window.layoutTestController) {
+     var box, x, y;
+     box = document.getElementById("box");
+     x = box.offsetParent.offsetLeft + box.offsetLeft + box.offsetWidth / 2;
+     y = box.offsetParent.offsetTop + box.offsetTop + box.offsetHeight / 2;
+     eventSender.mouseMoveTo(x, y);
+     eventSender.contextClick();
+     layoutTestController.dumpAsText();
+}
+
+</script>
\ No newline at end of file
index 3cb5f146ec3cc5c24c7f9e3b91d487114f79b383..4f039ddbb7af89e9027af798a090026a577ca0af 100644 (file)
@@ -1,3 +1,12 @@
+2007-12-10  Kevin Decker  <kdecker@apple.com>
+
+        Reviewed by Darin.
+
+        Fixed: <rdar://problem/4290098> Right-mouse click on element doesn't call onmousedown handler
+        
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView menuForEvent:]): Match behavior of other browsers by sending an onmousedown event for right clicks.
+
 2007-12-08  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Sam W.
index 4569339cc5032f310c60666180650ff8b2a6a006..7bc77847571eb07dd46c3f8835bba6c6d383f443 100644 (file)
@@ -2760,6 +2760,8 @@ static void _updateActiveStateTimerCallback(CFRunLoopTimerRef timer, void *info)
         return nil;
 
     page->contextMenuController()->clearContextMenu();
+    // Match behavior of other browsers by sending an onmousedown event for right clicks.
+    coreFrame->eventHandler()->mouseDown(event);
     handledEvent = coreFrame->eventHandler()->sendContextMenuEvent(PlatformMouseEvent(event));
     _private->handlingMouseDownEvent = NO;