Changeset 51142 in webkit


Ignore:
Timestamp:
Nov 18, 2009 3:10:54 PM (14 years ago)
Author:
eric@webkit.org
Message:

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):
Location:
trunk/WebKit/chromium
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r51130 r51142  
     12009-11-18  Evan Stade  <estade@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Menu button shows wrong content in Chromium
     6        https://bugs.webkit.org/show_bug.cgi?id=31448
     7
     8        Make context menu button (VK_APPS) show context menu for node that has
     9        keyboard focus. This affects both the content and the positioning.
     10
     11        * src/WebViewImpl.cpp:
     12        (WebKit::WebViewImpl::sendContextMenuEvent):
     13
    1142009-11-17  Darin Fisher  <darin@chromium.org>
    215
  • trunk/WebKit/chromium/src/WebViewImpl.cpp

    r50808 r51142  
    588588    Position end = mainFrameImpl->selection()->selection().end();
    589589
    590     if (!start.node() || !end.node()) {
     590    Frame* focusedFrame = page()->focusController()->focusedOrMainFrame();
     591    Node* focusedNode = focusedFrame->document()->focusedNode();
     592
     593    if (start.node() && end.node()) {
     594        RenderObject* renderer = start.node()->renderer();
     595        if (!renderer)
     596            return false;
     597
     598        RefPtr<Range> selection = mainFrameImpl->selection()->toNormalizedRange();
     599        IntRect firstRect = mainFrameImpl->firstRectForRange(selection.get());
     600
     601        int x = rightAligned ? firstRect.right() : firstRect.x();
     602        location = IntPoint(x, firstRect.bottom());
     603    } else if (focusedNode)
     604        location = focusedNode->getRect().bottomLeft();
     605    else {
    591606        location = IntPoint(
    592607            rightAligned ? view->contentsWidth() - kContextMenuMargin : kContextMenuMargin,
    593608            kContextMenuMargin);
    594     } else {
    595         RenderObject* renderer = start.node()->renderer();
    596         if (!renderer)
    597             return false;
    598 
    599         RefPtr<Range> selection = mainFrameImpl->selection()->toNormalizedRange();
    600         IntRect firstRect = mainFrameImpl->firstRectForRange(selection.get());
    601 
    602         int x = rightAligned ? firstRect.right() : firstRect.x();
    603         location = IntPoint(x, firstRect.bottom());
    604609    }
    605610
     
    618623    page()->contextMenuController()->clearContextMenu();
    619624
    620     Frame* focusedFrame = page()->focusController()->focusedOrMainFrame();
    621625    focusedFrame->view()->setCursor(pointerCursor());
    622626    WebMouseEvent mouseEvent;
Note: See TracChangeset for help on using the changeset viewer.