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

Unified Diff: webkit/glue/webview_impl.cc

Issue 160065: Paste at the beginning of a middle click rather than after letting the page h... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webview_impl.cc
===================================================================
--- webkit/glue/webview_impl.cc (revision 21448)
+++ webkit/glue/webview_impl.cc (working copy)
@@ -542,20 +542,10 @@
if (!main_frame() || !main_frame()->frameview())
return;
- mouseCaptureLost();
- main_frame()->frame()->eventHandler()->handleMouseReleaseEvent(
- MakePlatformMouseEvent(main_frame()->frameview(), event));
-
-#if defined(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 defined(OS_LINUX)
// If the event was a middle click, attempt to copy text into the focused
- // frame.
+ // frame. We execute this before we let the page have a go at the event
+ // because the page may change what is focused during in its event handler.
//
// This code is in the mouse up handler. There is some debate about putting
// this here, as opposed to the mouse down handler.
@@ -571,15 +561,24 @@
// handleMouseReleaseEvent() earlier in this function
if (event.button == WebMouseEvent::ButtonMiddle) {
Frame* focused = GetFocusedWebCoreFrame();
- if (!focused)
- return;
- Editor* editor = focused->editor();
- if (!editor || !editor->canEdit())
- return;
-
- delegate_->PasteFromSelectionClipboard();
+ if (focused) {
+ Editor* editor = focused->editor();
+ if (editor && editor->canEdit())
+ delegate_->PasteFromSelectionClipboard();
+ }
}
#endif
+
+ mouseCaptureLost();
+ main_frame()->frame()->eventHandler()->handleMouseReleaseEvent(
+ MakePlatformMouseEvent(main_frame()->frameview(), event));
+
+#if defined(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
}
void WebViewImpl::MouseWheel(const WebMouseWheelEvent& event) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698