diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-25 03:30:34 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-25 03:30:34 +0000 |
commit | 42be0ca594ed7980c7ee73ef04919cd890463e9a (patch) | |
tree | 2a842c204463a24dd792734ab7d4867974ca5381 /webkit/glue/webview_impl.cc | |
parent | 4fb105e615d1ee15127f8b293e7e3361ed7c74b0 (diff) | |
download | chromium_src-42be0ca594ed7980c7ee73ef04919cd890463e9a.zip chromium_src-42be0ca594ed7980c7ee73ef04919cd890463e9a.tar.gz chromium_src-42be0ca594ed7980c7ee73ef04919cd890463e9a.tar.bz2 |
Ensure "contextmenu" event is dispatched _after_ "mouseup".
BUG=1330688
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1299 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webview_impl.cc')
-rw-r--r-- | webkit/glue/webview_impl.cc | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index bad4d06..7121ecd 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -221,39 +221,43 @@ void WebViewImpl::MouseDown(const WebMouseEvent& event) { MakePlatformMouseEvent(main_frame_->frameview(), event)); } -void WebViewImpl::MouseUp(const WebMouseEvent& event) { - if (event.button == WebMouseEvent::BUTTON_RIGHT) { - page_->contextMenuController()->clearContextMenu(); - - MakePlatformMouseEvent pme(main_frame_->frameview(), event); - - // Find the right target frame. See issue 1186900. - IntPoint doc_point( - main_frame_->frame()->view()->windowToContents(pme.pos())); - HitTestResult result = - main_frame_->frame()->eventHandler()->hitTestResultAtPoint(doc_point, - false); - Frame* target_frame; - if (result.innerNonSharedNode()) - target_frame = result.innerNonSharedNode()->document()->frame(); - else - target_frame = page_->focusController()->focusedOrMainFrame(); - - target_frame->view()->setCursor(pointerCursor()); - - context_menu_allowed_ = true; - target_frame->eventHandler()->sendContextMenuEvent(pme); - context_menu_allowed_ = false; - // Actually showing the context menu is handled by the ContextMenuClient - // implementation... - } +void WebViewImpl::MouseContextMenu(const WebMouseEvent& event) { + page_->contextMenuController()->clearContextMenu(); + + MakePlatformMouseEvent pme(main_frame_->frameview(), event); + + // Find the right target frame. See issue 1186900. + IntPoint doc_point( + main_frame_->frame()->view()->windowToContents(pme.pos())); + HitTestResult result = + main_frame_->frame()->eventHandler()->hitTestResultAtPoint(doc_point, + false); + Frame* target_frame; + if (result.innerNonSharedNode()) + target_frame = result.innerNonSharedNode()->document()->frame(); + else + target_frame = page_->focusController()->focusedOrMainFrame(); + + target_frame->view()->setCursor(pointerCursor()); + context_menu_allowed_ = true; + target_frame->eventHandler()->sendContextMenuEvent(pme); + context_menu_allowed_ = false; + // Actually showing the context menu is handled by the ContextMenuClient + // implementation... +} + +void WebViewImpl::MouseUp(const WebMouseEvent& event) { if (!main_frame_->frameview()) return; MouseCaptureLost(); main_frame_->frameview()->frame()->eventHandler()->handleMouseReleaseEvent( MakePlatformMouseEvent(main_frame_->frameview(), event)); + + // Dispatch the contextmenu event regardless of if the click was swallowed. + if (event.button == WebMouseEvent::BUTTON_RIGHT) + MouseContextMenu(event); } void WebViewImpl::MouseWheel(const WebMouseWheelEvent& event) { |