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

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

Issue 2141993003: PointerEvents for long-press: fix double firing & canceling MEs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted cherry-picked DOM dispatch. Created 4 years, 5 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: third_party/WebKit/Source/core/input/EventHandler.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp
index 11ceff8b9b76b21dd8383d2dc9c321f1049c6cf5..53b70f79f26ce7f68bb927fc2aa0fd435efe5a54 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -862,14 +862,15 @@ WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent
}
// m_selectionInitiationState is initialized after dispatching mousedown
- // event in order not to keep the selection by DOM APIs Because we can't
+ // event in order not to keep the selection by DOM APIs because we can't
// give the user the chance to handle the selection by user action like
// dragging if we keep the selection in case of mousedown. FireFox also has
// the same behavior and it's more compatible with other browsers.
selectionController().initializeSelectionState();
HitTestResult hitTestResult = hitTestResultInFrame(m_frame, documentPoint, HitTestRequest::ReadOnly);
- InputDeviceCapabilities* sourceCapabilities = mouseEvent.getSyntheticEventType() == PlatformMouseEvent::FromTouch ? InputDeviceCapabilities::firesTouchEventsSourceCapabilities() :
- InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities();
+ InputDeviceCapabilities* sourceCapabilities = mouseEvent.getSyntheticEventType() == PlatformMouseEvent::FromTouch
dtapuska 2016/07/20 16:26:08 Is this "git cl format" doing the formatting chang
mustaq 2016/07/20 16:36:44 Done.
+ ? InputDeviceCapabilities::firesTouchEventsSourceCapabilities()
+ : InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities();
if (eventResult == WebInputEventResult::NotHandled)
eventResult = handleMouseFocus(MouseEventWithHitTestResults(mev.event(), hitTestResult), sourceCapabilities);
m_capturesDragging = eventResult == WebInputEventResult::NotHandled || mev.scrollbar();
@@ -1493,7 +1494,8 @@ void EventHandler::elementRemoved(EventTarget* target)
}
// TODO(mustaq): Make PE drive ME dispatch & bookkeeping in EventHandler.
-WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const AtomicString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent)
+WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(
dtapuska 2016/07/20 16:26:08 ditto
mustaq 2016/07/20 16:36:44 Done.
+ const AtomicString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent)
{
ASSERT(mouseEventType == EventTypeNames::mousedown
|| mouseEventType == EventTypeNames::mousemove
@@ -1501,6 +1503,10 @@ WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const Ato
Node* lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mouseEvent);
+ if (mouseEvent.getSyntheticEventType() == PlatformMouseEvent::FromTouch) {
dtapuska 2016/07/20 16:26:08 braces not needed
mustaq 2016/07/20 16:36:44 Done.
+ return dispatchMouseEvent(mouseEventType, m_nodeUnderMouse, clickCount, mouseEvent);
+ }
+
return m_pointerEventManager.sendMousePointerEvent(
m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, nullptr,
lastNodeUnderMouse);
@@ -2093,39 +2099,6 @@ WebInputEventResult EventHandler::sendContextMenuEventForKey(Element* overrideTa
return sendContextMenuEvent(mouseEvent, overrideTargetElement);
}
-WebInputEventResult EventHandler::sendContextMenuEventForGesture(const GestureEventWithHitTestResults& targetedEvent)
-{
- const PlatformGestureEvent& gestureEvent = targetedEvent.event();
- unsigned modifiers = gestureEvent.getModifiers();
-
- // Send MouseMoved event prior to handling (https://crbug.com/485290).
- PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globalPosition(),
- NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0,
- static_cast<PlatformEvent::Modifiers>(modifiers),
- PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerProperties::PointerType::Mouse);
- dispatchMouseEvent(EventTypeNames::mousemove, targetedEvent.hitTestResult().innerNode(), 0, fakeMouseMove);
-
- PlatformEvent::EventType eventType = PlatformEvent::MousePressed;
-
- if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp())
- eventType = PlatformEvent::MouseReleased;
-
- // Always set right button down as we are sending mousedown event regardless
- modifiers |= PlatformEvent::RightButtonDown;
-
- // TODO(crbug.com/579564): Maybe we should not send mouse down at all
- PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEvent.event().globalPosition(), RightButton, eventType, 1,
- static_cast<PlatformEvent::Modifiers>(modifiers),
- PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::Mouse);
- // To simulate right-click behavior, we send a right mouse down and then
- // context menu event.
- // FIXME: Send HitTestResults to avoid redundant hit tests.
- handleMousePressEvent(mouseEvent);
- return sendContextMenuEvent(mouseEvent);
- // We do not need to send a corresponding mouse release because in case of
- // right-click, the context menu takes capture and consumes all events.
-}
-
void EventHandler::scheduleHoverStateUpdate()
{
if (!m_hoverTimer.isActive())
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | third_party/WebKit/Source/core/input/GestureManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698