Commit da4f95e8 authored by mboc@opera.com's avatar mboc@opera.com

CHR-1706: Context menu with Shift+F10 shows out of Opera when web contents...

CHR-1706: Context menu with Shift+F10 shows out of Opera when web contents scrolled. In case we are opening a context menu on an element, the menu should be shown as currently, since the element has most probably a correct transform available. Since the <body> element possibly has contents of great height, the context menu should be shown on the upper edge of the displayed part of the element.

BUG=Context menu with Shift+F10 shows out of Opera when web contents scrolled.
The menu's position should not be translated by scroll position in case of
opening a menu for the <body> element.

Review URL: https://codereview.chromium.org/110533004

git-svn-id: svn://svn.chromium.org/blink/trunk@169956 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f52fbd4f
......@@ -2818,6 +2818,7 @@ bool EventHandler::sendContextMenuEventForKey()
Element* focusedElement = doc->focusedElement();
FrameSelection& selection = m_frame->selection();
Position start = selection.selection().start();
bool shouldTranslateToRootView = true;
if (start.deprecatedNode() && (selection.rootEditableElement() || selection.isRange())) {
RefPtr<Range> selectionRange = selection.toNormalizedRange();
......@@ -2837,11 +2838,12 @@ bool EventHandler::sendContextMenuEventForKey()
location = IntPoint(
rightAligned ? view->contentsWidth() - kContextMenuMargin : kContextMenuMargin,
kContextMenuMargin);
shouldTranslateToRootView = false;
}
m_frame->view()->setCursor(pointerCursor());
IntPoint position = view->contentsToRootView(location);
IntPoint position = shouldTranslateToRootView ? view->contentsToRootView(location) : location;
IntPoint globalPosition = view->hostWindow()->rootViewToScreen(IntRect(position, IntSize())).location();
Node* targetNode = doc->focusedElement();
......
Markdown is supported
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