diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-25 23:11:30 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-25 23:11:30 +0000 |
commit | 111f928c57720b130f374eb6a0ad300d180e3a7d (patch) | |
tree | c90c60217511dbeb37fc5291040da60fc6378ee1 /webkit | |
parent | da11eed5cd62f052f6b335f21ebb451ec2b3e510 (diff) | |
download | chromium_src-111f928c57720b130f374eb6a0ad300d180e3a7d.zip chromium_src-111f928c57720b130f374eb6a0ad300d180e3a7d.tar.gz chromium_src-111f928c57720b130f374eb6a0ad300d180e3a7d.tar.bz2 |
Linux: paste on middle-click up.
There is some debate about when pasting should actually happen
xterm: pastes on up.
GTK: pastes on down.
Firefox: pastes on up.
Midori: couldn't paste at all with 0.1.2
There is something of a webcompat angle to this well, as highlighted by
crbug.com/14608. Pages can clear text boxes 'onclick' and, if we paste on
down then the text is pasted just before the onclick handler runs and
clears the text box.
http://codereview.chromium.org/149020
BUG=14608
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webview_impl.cc | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index d057b09..e40d27b 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -477,21 +477,6 @@ void WebViewImpl::MouseDown(const WebMouseEvent& event) { 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. - if (event.button == WebMouseEvent::ButtonMiddle) { - Frame* focused = GetFocusedWebCoreFrame(); - if (!focused) - return; - Editor* editor = focused->editor(); - if (!editor || !editor->canEdit()) - return; - - delegate_->PasteFromSelectionClipboard(); - } -#endif } void WebViewImpl::MouseContextMenu(const WebMouseEvent& event) { @@ -535,6 +520,34 @@ void WebViewImpl::MouseUp(const WebMouseEvent& event) { 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. + // + // This code is in the mouse up handler. There is some debate about putting + // this here, as opposed to the mouse down handler. + // xterm: pastes on up. + // GTK: pastes on down. + // Firefox: pastes on up. + // Midori: couldn't paste at all with 0.1.2 + // + // There is something of a webcompat angle to this well, as highlighted by + // crbug.com/14608. Pages can clear text boxes 'onclick' and, if we paste on + // down then the text is pasted just before the onclick handler runs and + // clears the text box. So it's important this happens after the + // 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(); + } +#endif } void WebViewImpl::MouseWheel(const WebMouseWheelEvent& event) { |