Commit dbf49992 authored by eric@webkit.org's avatar eric@webkit.org
Browse files

2009-11-18 Evan Stade <estade@chromium.org>

        Reviewed by Darin Fisher.

        Menu button shows wrong content in Chromium
        https://bugs.webkit.org/show_bug.cgi?id=31448

        Make context menu button (VK_APPS) show context menu for node that has
        keyboard focus. This affects both the content and the positioning.

        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::sendContextMenuEvent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51142 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bce4c9df
2009-11-18 Evan Stade <estade@chromium.org>
Reviewed by Darin Fisher.
Menu button shows wrong content in Chromium
https://bugs.webkit.org/show_bug.cgi?id=31448
Make context menu button (VK_APPS) show context menu for node that has
keyboard focus. This affects both the content and the positioning.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::sendContextMenuEvent):
2009-11-17 Darin Fisher <darin@chromium.org>
Reviewed by Dmitry Titov.
......
......@@ -587,11 +587,10 @@ bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event)
Position start = mainFrameImpl->selection()->selection().start();
Position end = mainFrameImpl->selection()->selection().end();
if (!start.node() || !end.node()) {
location = IntPoint(
rightAligned ? view->contentsWidth() - kContextMenuMargin : kContextMenuMargin,
kContextMenuMargin);
} else {
Frame* focusedFrame = page()->focusController()->focusedOrMainFrame();
Node* focusedNode = focusedFrame->document()->focusedNode();
if (start.node() && end.node()) {
RenderObject* renderer = start.node()->renderer();
if (!renderer)
return false;
......@@ -601,6 +600,12 @@ bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event)
int x = rightAligned ? firstRect.right() : firstRect.x();
location = IntPoint(x, firstRect.bottom());
} else if (focusedNode)
location = focusedNode->getRect().bottomLeft();
else {
location = IntPoint(
rightAligned ? view->contentsWidth() - kContextMenuMargin : kContextMenuMargin,
kContextMenuMargin);
}
location = view->contentsToWindow(location);
......@@ -617,7 +622,6 @@ bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event)
// not run.
page()->contextMenuController()->clearContextMenu();
Frame* focusedFrame = page()->focusController()->focusedOrMainFrame();
focusedFrame->view()->setCursor(pointerCursor());
WebMouseEvent mouseEvent;
mouseEvent.button = WebMouseEvent::ButtonRight;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment