Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1102)

Unified Diff: Source/core/page/EventHandler.cpp

Issue 1007503003: Fixed key event context menu and added tests for coordinate cleanups (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed typo in expectation Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index 020bff1e545e23f42904c39260113050db38a294..ee47a84ba21251735ce6bed76eef2eaa8bb1c5a8 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -2959,11 +2959,11 @@ bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event)
// Clear mouse press state to avoid initiating a drag while context menu is up.
m_mousePressed = false;
- LayoutPoint viewportPos = v->rootFrameToContents(event.position());
+ LayoutPoint positionInContents = v->rootFrameToContents(event.position());
HitTestRequest request(HitTestRequest::Active);
- MouseEventWithHitTestResults mev = doc->prepareMouseEvent(request, viewportPos, event);
+ MouseEventWithHitTestResults mev = doc->prepareMouseEvent(request, positionInContents, event);
- if (!m_frame->selection().contains(viewportPos)
+ if (!m_frame->selection().contains(positionInContents)
&& !mev.scrollbar()
// FIXME: In the editable case, word selection sometimes selects content that isn't underneath the mouse.
// If the selection is non-editable, we do word selection to make it easier to use the contextual menu items
@@ -3021,8 +3021,10 @@ bool EventHandler::sendContextMenuEventForKey()
locationInRootFrame = flooredIntPoint(pinchViewport.viewportCSSPixelsToRootFrame(clippedRect.center()));
} else {
locationInRootFrame = IntPoint(
- rightAligned ? pinchViewport.visibleRect().maxX() - kContextMenuMargin : kContextMenuMargin,
- kContextMenuMargin);
+ rightAligned
+ ? pinchViewport.visibleRect().maxX() - kContextMenuMargin
+ : pinchViewport.location().x() + kContextMenuMargin,
+ pinchViewport.location().y() + kContextMenuMargin);
}
m_frame->view()->setCursor(pointerCursor());

Powered by Google App Engine
This is Rietveld 408576698