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

Unified Diff: third_party/WebKit/Source/core/input/GestureManager.cpp

Issue 2446333002: Set right button for mousedown/contextmenu of long press gesture (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/touch/gesture/context-menu-on-two-finger-tap-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/input/GestureManager.cpp
diff --git a/third_party/WebKit/Source/core/input/GestureManager.cpp b/third_party/WebKit/Source/core/input/GestureManager.cpp
index 4171e89cb9197b23cbf1b6600eb877ce0052d7e0..6103787f9aa99369499208e06b72d5cb72d38722 100644
--- a/third_party/WebKit/Source/core/input/GestureManager.cpp
+++ b/third_party/WebKit/Source/core/input/GestureManager.cpp
@@ -360,13 +360,12 @@ WebInputEventResult GestureManager::sendContextMenuEventForGesture(
fakeMouseMove);
}
- PlatformEvent::EventType eventType = PlatformEvent::MousePressed;
- if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp())
- eventType = PlatformEvent::MouseReleased;
PlatformMouseEvent mouseEvent(
targetedEvent.event().position(), targetedEvent.event().globalPosition(),
- WebPointerProperties::Button::NoButton, eventType, /* clickCount */ 0,
- static_cast<PlatformEvent::Modifiers>(modifiers),
+ WebPointerProperties::Button::NoButton, PlatformEvent::MousePressed,
+ /* clickCount */ 1,
+ static_cast<PlatformEvent::Modifiers>(
+ modifiers | PlatformEvent::Modifiers::RightButtonDown),
PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(),
WebPointerProperties::PointerType::Mouse);
@@ -389,8 +388,27 @@ WebInputEventResult GestureManager::sendContextMenuEventForGesture(
if (eventResult == WebInputEventResult::NotHandled)
m_mouseEventManager->handleMousePressEvent(mev);
- }
+ if (m_frame->settings() &&
+ m_frame->settings()->showContextMenuOnMouseUp()) {
+ m_mouseEventManager->setMousePositionAndDispatchMouseEvent(
+ mev.innerNode(), EventTypeNames::mouseup, mouseEvent);
+ m_mouseEventManager->setClickNode(mev.innerNode());
+ m_mouseEventManager->setClickCount(1);
+ m_mouseEventManager->dispatchMouseClickIfNeeded(mev);
+ return m_frame->eventHandler().sendContextMenuEvent(mouseEvent);
+ }
+ WebInputEventResult result =
+ m_frame->eventHandler().sendContextMenuEvent(mouseEvent);
+ if (result != WebInputEventResult::NotHandled) {
+ m_mouseEventManager->setMousePositionAndDispatchMouseEvent(
+ mev.innerNode(), EventTypeNames::mouseup, mouseEvent);
+ m_mouseEventManager->setClickNode(mev.innerNode());
+ m_mouseEventManager->setClickCount(1);
+ m_mouseEventManager->dispatchMouseClickIfNeeded(mev);
Navid Zolghadr 2016/10/25 20:12:37 Do you think these few lines are worth adding a ne
+ }
+ return result;
+ }
return m_frame->eventHandler().sendContextMenuEvent(mouseEvent);
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/touch/gesture/context-menu-on-two-finger-tap-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698