Title: [138380] trunk
- Revision
- 138380
- Author
- [email protected]
- Date
- 2012-12-21 08:19:35 -0800 (Fri, 21 Dec 2012)
Log Message
[Chromium/Mac] Don't send an onclick event from a ctrl-click
https://bugs.webkit.org/show_bug.cgi?id=105554
Patch by Alexei Svitkine <[email protected]> on 2012-12-21
Reviewed by Dimitri Glazkov.
Don't send the onclick event on a control click event (which
triggers the context menu on the Mac). This matches the
behaviour of the Apple Mac port, although the Apple port
does this by checking whether the context menu is visible
in WebPage::mouseEvent().
This is a fix for http://crbug.com/146143
Source/WebCore:
Test: fast/events/controlclick-no-onclick.html
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseReleaseEvent):
LayoutTests:
* fast/events/controlclick-no-onclick-expected.txt: Added.
* fast/events/controlclick-no-onclick.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (138379 => 138380)
--- trunk/LayoutTests/ChangeLog 2012-12-21 16:01:59 UTC (rev 138379)
+++ trunk/LayoutTests/ChangeLog 2012-12-21 16:19:35 UTC (rev 138380)
@@ -1,3 +1,21 @@
+2012-12-21 Alexei Svitkine <[email protected]>
+
+ [Chromium/Mac] Don't send an onclick event from a ctrl-click
+ https://bugs.webkit.org/show_bug.cgi?id=105554
+
+ Reviewed by Dimitri Glazkov.
+
+ Don't send the onclick event on a control click event (which
+ triggers the context menu on the Mac). This matches the
+ behaviour of the Apple Mac port, although the Apple port
+ does this by checking whether the context menu is visible
+ in WebPage::mouseEvent().
+
+ This is a fix for http://crbug.com/146143
+
+ * fast/events/controlclick-no-onclick-expected.txt: Added.
+ * fast/events/controlclick-no-onclick.html: Added.
+
2012-12-21 Shinya Kawanaka <[email protected]>
Implement ShadowRoot::elementFromPoint
Added: trunk/LayoutTests/fast/events/controlclick-no-onclick-expected.txt (0 => 138380)
--- trunk/LayoutTests/fast/events/controlclick-no-onclick-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/controlclick-no-onclick-expected.txt 2012-12-21 16:19:35 UTC (rev 138380)
@@ -0,0 +1,2 @@
+This tests to make sure that a control click does not result in a click event on the Mac.
+PASS
Added: trunk/LayoutTests/fast/events/controlclick-no-onclick.html (0 => 138380)
--- trunk/LayoutTests/fast/events/controlclick-no-onclick.html (rev 0)
+++ trunk/LayoutTests/fast/events/controlclick-no-onclick.html 2012-12-21 16:19:35 UTC (rev 138380)
@@ -0,0 +1,24 @@
+<html>
+<body>
+<div id="box" _onclick_="document.getElementById('result').innerHTML = 'FAIL';" style="border:1px dotted red">This tests to make sure that a control click does not result in a click event on the Mac.</div>
+<p id='result'>PASS</p>
+</body>
+</html>
+
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+
+ var isMacOSX = navigator.userAgent.indexOf("Mac OS X") != -1;
+ if (isMacOSX) {
+ var box = document.getElementById("box");
+ var x = box.offsetParent.offsetLeft + box.offsetLeft + box.offsetWidth / 2;
+ var y = box.offsetParent.offsetTop + box.offsetTop + box.offsetHeight / 2;
+ eventSender.dragMode = false;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown(0, ['ctrlKey']);
+ eventSender.mouseUp(0, ['ctrlKey']);
+ }
+}
+
+</script>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (138379 => 138380)
--- trunk/Source/WebCore/ChangeLog 2012-12-21 16:01:59 UTC (rev 138379)
+++ trunk/Source/WebCore/ChangeLog 2012-12-21 16:19:35 UTC (rev 138380)
@@ -1,3 +1,23 @@
+2012-12-21 Alexei Svitkine <[email protected]>
+
+ [Chromium/Mac] Don't send an onclick event from a ctrl-click
+ https://bugs.webkit.org/show_bug.cgi?id=105554
+
+ Reviewed by Dimitri Glazkov.
+
+ Don't send the onclick event on a control click event (which
+ triggers the context menu on the Mac). This matches the
+ behaviour of the Apple Mac port, although the Apple port
+ does this by checking whether the context menu is visible
+ in WebPage::mouseEvent().
+
+ This is a fix for http://crbug.com/146143
+
+ Test: fast/events/controlclick-no-onclick.html
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleMouseReleaseEvent):
+
2012-12-21 Shinya Kawanaka <[email protected]>
Implement ShadowRoot::elementFromPoint
Modified: trunk/Source/WebCore/page/EventHandler.cpp (138379 => 138380)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-12-21 16:01:59 UTC (rev 138379)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-12-21 16:19:35 UTC (rev 138380)
@@ -1818,7 +1818,13 @@
clickTarget = clickTarget->shadowAncestorNode();
Node* adjustedClickNode = m_clickNode ? m_clickNode->shadowAncestorNode() : 0;
- bool swallowClickEvent = m_clickCount > 0 && mouseEvent.button() != RightButton && clickTarget == adjustedClickNode && !dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
+ bool contextMenuEvent = mouseEvent.button() == RightButton;
+#if PLATFORM(CHROMIUM) && OS(DARWIN)
+ // FIXME: The Mac port achieves the same behavior by checking whether the context menu is currently open in WebPage::mouseEvent(). Consider merging the implementations.
+ if (mouseEvent.button() == LeftButton && mouseEvent.modifiers() & PlatformEvent::CtrlKey)
+ contextMenuEvent = true;
+#endif
+ bool swallowClickEvent = m_clickCount > 0 && !contextMenuEvent && clickTarget == adjustedClickNode && !dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
if (m_resizeLayer) {
m_resizeLayer->setInResizeMode(false);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes