Title: [196112] trunk
- Revision
- 196112
- Author
- [email protected]
- Date
- 2016-02-04 00:25:28 -0800 (Thu, 04 Feb 2016)
Log Message
Do not show context menu when right clicking on a scrollbar
https://bugs.webkit.org/show_bug.cgi?id=153493
Reviewed by Michael Catanzaro.
Source/WebCore:
Scrollbars don't currently handle right clicks, but we are showing
the context menu when they are right clicked. This is not desired
at least in GTK+ and I've checked that it isn't consistent with
other applications in Mac either.
Test: fast/events/contextmenu-on-scrollbars.html
* page/EventHandler.cpp:
(WebCore::EventHandler::sendContextMenuEvent):
LayoutTests:
Add a test to check that context menu event is not sent when right
clicking on a scrollbar.
* fast/events/contextmenu-on-scrollbars-expected.txt: Added.
* fast/events/contextmenu-on-scrollbars.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (196111 => 196112)
--- trunk/LayoutTests/ChangeLog 2016-02-04 07:37:52 UTC (rev 196111)
+++ trunk/LayoutTests/ChangeLog 2016-02-04 08:25:28 UTC (rev 196112)
@@ -1,3 +1,16 @@
+2016-02-03 Carlos Garcia Campos <[email protected]>
+
+ Do not show context menu when right clicking on a scrollbar
+ https://bugs.webkit.org/show_bug.cgi?id=153493
+
+ Reviewed by Michael Catanzaro.
+
+ Add a test to check that context menu event is not sent when right
+ clicking on a scrollbar.
+
+ * fast/events/contextmenu-on-scrollbars-expected.txt: Added.
+ * fast/events/contextmenu-on-scrollbars.html: Added.
+
2016-02-03 Beth Dakin <[email protected]>
Accepted candidates should not be autocorrected
Added: trunk/LayoutTests/fast/events/contextmenu-on-scrollbars-expected.txt (0 => 196112)
--- trunk/LayoutTests/fast/events/contextmenu-on-scrollbars-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/contextmenu-on-scrollbars-expected.txt 2016-02-04 08:25:28 UTC (rev 196112)
@@ -0,0 +1,4 @@
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=153493
+
+SUCCESS
+
Added: trunk/LayoutTests/fast/events/contextmenu-on-scrollbars.html (0 => 196112)
--- trunk/LayoutTests/fast/events/contextmenu-on-scrollbars.html (rev 0)
+++ trunk/LayoutTests/fast/events/contextmenu-on-scrollbars.html 2016-02-04 08:25:28 UTC (rev 196112)
@@ -0,0 +1,52 @@
+
+<style>
+ #scrollme {
+ width: 100px;
+ height: 100px;
+ overflow: auto;
+ }
+ #scrollme p {
+ height: 1000px;
+ }
+</style>
+<body style="min-height: 5000px">
+<p>This is a test for <a href=""
+<div id="scrollme"><p></p></div>
+<pre id="log"></pre>
+<div style="height: 150%"></div>
+<script>
+ function log(msg)
+ {
+ document.getElementById('log').appendChild(document.createTextNode(msg + "\n"));
+ }
+
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var didSendContextMenu = false;
+
+ document._oncontextmenu_ = function() { didSendContextMenu = true; }
+
+ if (window.eventSender) {
+ var failed = false;
+
+ eventSender.mouseMoveTo(window.innerWidth - 4, window.innerHeight - 4);
+ eventSender.contextClick();
+ if (didSendContextMenu) {
+ log('FAILED: context menu event received on main frame scrollbar');
+ failed = true;
+ didSendContextMenu = false;
+ }
+
+ var div = document.querySelector('#scrollme');
+ eventSender.mouseMoveTo(div.offsetLeft + div.offsetWidth - 4, div.offsetTop + 1);
+ eventSender.contextClick();
+ if (didSendContextMenu) {
+ log('FAILED: context menu event received on div scrollbar');
+ failed = true;
+ }
+ if (!failed)
+ log('SUCCESS');
+ }
+</script>
+</body>
Modified: trunk/Source/WebCore/ChangeLog (196111 => 196112)
--- trunk/Source/WebCore/ChangeLog 2016-02-04 07:37:52 UTC (rev 196111)
+++ trunk/Source/WebCore/ChangeLog 2016-02-04 08:25:28 UTC (rev 196112)
@@ -1,3 +1,20 @@
+2016-02-03 Carlos Garcia Campos <[email protected]>
+
+ Do not show context menu when right clicking on a scrollbar
+ https://bugs.webkit.org/show_bug.cgi?id=153493
+
+ Reviewed by Michael Catanzaro.
+
+ Scrollbars don't currently handle right clicks, but we are showing
+ the context menu when they are right clicked. This is not desired
+ at least in GTK+ and I've checked that it isn't consistent with
+ other applications in Mac either.
+
+ Test: fast/events/contextmenu-on-scrollbars.html
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::sendContextMenuEvent):
+
2016-02-03 Andreas Kling <[email protected]>
[iOS] Throw away linked code when navigating to a new page.
Modified: trunk/Source/WebCore/page/EventHandler.cpp (196111 => 196112)
--- trunk/Source/WebCore/page/EventHandler.cpp 2016-02-04 07:37:52 UTC (rev 196111)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2016-02-04 08:25:28 UTC (rev 196112)
@@ -2692,20 +2692,23 @@
bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event)
{
Document* doc = m_frame.document();
- FrameView* v = m_frame.view();
- if (!v)
+ FrameView* view = m_frame.view();
+ if (!view)
return false;
-
+
// Clear mouse press state to avoid initiating a drag while context menu is up.
m_mousePressed = false;
bool swallowEvent;
- LayoutPoint viewportPos = v->windowToContents(event.position());
+ LayoutPoint viewportPos = view->windowToContents(event.position());
HitTestRequest request(HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
MouseEventWithHitTestResults mouseEvent = doc->prepareMouseEvent(request, viewportPos, event);
+ // Do not show context menus when clicking on scrollbars.
+ if (mouseEvent.scrollbar() || view->scrollbarAtPoint(event.position()))
+ return false;
+
if (m_frame.editor().behavior().shouldSelectOnContextualMenuClick()
&& !m_frame.selection().contains(viewportPos)
- && !mouseEvent.scrollbar()
// FIXME: In the editable case, word selection sometimes selects content that isn't underneath the mouse.
// If the selection is non-editable, we do word selection to make it easier to use the contextual menu items
// available for text selections. But only if we're above text.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes