Chromium Code Reviews| 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 8c2790eee6eed70c0a7c97cedfb7a49c002fa6dd..3cd4be1230b0e4d121a703afa897e124990dd3bd 100644 |
| --- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
| +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| @@ -774,7 +774,7 @@ static LayoutPoint contentPointFromRootFrame(LocalFrame* frame, const IntPoint& |
| return view ? view->rootFrameToContents(pointInRootFrame) : pointInRootFrame; |
| } |
| -WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) |
| +WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent, const bool synthesizedFromTouch) |
| { |
| TRACE_EVENT0("blink", "EventHandler::handleMousePressEvent"); |
| @@ -853,7 +853,8 @@ WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent |
| if (!mouseEvent.fromTouch()) |
| m_frame->selection().setCaretBlinkingSuspended(true); |
| - WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(EventTypeNames::mousedown, mev.innerNode(), m_clickCount, mev.event()); |
| + WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents( |
| + EventTypeNames::mousedown, mev.innerNode(), m_clickCount, mev.event(), synthesizedFromTouch); |
| if (eventResult == WebInputEventResult::NotHandled && m_frame->view()) { |
| FrameView* view = m_frame->view(); |
| @@ -872,8 +873,9 @@ WebInputEventResult EventHandler::handleMousePressEvent(const PlatformMouseEvent |
| // 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 |
| + ? InputDeviceCapabilities::firesTouchEventsSourceCapabilities() |
| + : InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities(); |
| if (eventResult == WebInputEventResult::NotHandled) |
| eventResult = handleMouseFocus(MouseEventWithHitTestResults(mev.event(), hitTestResult), sourceCapabilities); |
| m_capturesDragging = eventResult == WebInputEventResult::NotHandled || mev.scrollbar(); |
| @@ -1497,7 +1499,7 @@ 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(const AtomicString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent, const bool synthesizedFromTouch) |
| { |
| ASSERT(mouseEventType == EventTypeNames::mousedown |
| || mouseEventType == EventTypeNames::mousemove |
| @@ -1505,6 +1507,9 @@ WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const Ato |
| Node* lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mouseEvent); |
| + if (synthesizedFromTouch) |
| + return dispatchMouseEvent(mouseEventType, m_nodeUnderMouse, clickCount, mouseEvent); |
| + |
| return m_pointerEventManager.sendMousePointerEvent( |
| m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, nullptr, |
| lastNodeUnderMouse); |
| @@ -2389,7 +2394,9 @@ WebInputEventResult EventHandler::sendContextMenuEventForGesture(const GestureEv |
| // 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); |
| + |
| + handleMousePressEvent(mouseEvent, true); |
|
Rick Byers
2016/07/14 14:27:10
I think the real bug here related to the above FIX
mustaq
2016/07/14 15:05:14
I tried to address the TODO but Edge sends mousedo
|
| + |
| 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. |