Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Unified Diff: Source/web/WebViewImpl.cpp

Issue 776483002: Use the setting to determine whether showing context menu on mouse up. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add layout test and exclude modifiers part. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« Source/core/page/EventHandler.cpp ('K') | « Source/core/page/EventHandler.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index f518fb0c0ad0802f15bf912fd2601e6d92333e90..f26de9a14852c0c662258a8585b7eb0ea65d2bc9 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -535,17 +535,17 @@ void WebViewImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEvent& ev
}
// Dispatch the contextmenu event regardless of if the click was swallowed.
-#if OS(WIN)
- // On Windows, we handle it on mouse up, not down.
-#elif OS(MACOSX)
- if (event.button == WebMouseEvent::ButtonRight
- || (event.button == WebMouseEvent::ButtonLeft
- && event.modifiers & WebMouseEvent::ControlKey))
- mouseContextMenu(event);
+ if (!page()->settings().showContextMenuOnMouseUp()) {
+#if OS(MACOSX)
+ if (event.button == WebMouseEvent::ButtonRight
+ || (event.button == WebMouseEvent::ButtonLeft
+ && event.modifiers & WebMouseEvent::ControlKey))
+ mouseContextMenu(event);
#else
- if (event.button == WebMouseEvent::ButtonRight)
- mouseContextMenu(event);
+ if (event.button == WebMouseEvent::ButtonRight)
+ mouseContextMenu(event);
#endif
+ }
}
void WebViewImpl::mouseContextMenu(const WebMouseEvent& event)
@@ -585,12 +585,12 @@ void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even
{
PageWidgetEventHandler::handleMouseUp(mainFrame, event);
-#if OS(WIN)
- // Dispatch the contextmenu event regardless of if the click was swallowed.
- // On Mac/Linux, we handle it on mouse down, not up.
- if (event.button == WebMouseEvent::ButtonRight)
- mouseContextMenu(event);
-#endif
+ if (page()->settings().showContextMenuOnMouseUp()) {
+ // Dispatch the contextmenu event regardless of if the click was swallowed.
+ // On Mac/Linux, we handle it on mouse down, not up.
+ if (event.button == WebMouseEvent::ButtonRight)
+ mouseContextMenu(event);
+ }
}
bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEvent& event)
« Source/core/page/EventHandler.cpp ('K') | « Source/core/page/EventHandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698