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 29a8ac7ed8ef95ab40275af2be91d00086052b20..e583c612d15d1a95571507db831a2fa8f99c9069 100644 |
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
@@ -315,6 +315,7 @@ void EventHandler::clear() |
m_scrollbarHandlingScrollGesture = nullptr; |
m_touchPressed = false; |
m_pointerIdManager.clear(); |
+ m_preventMouseEventForPointerTypeMouse = false; |
m_inPointerCanceledState = false; |
m_mouseDownMayStartDrag = false; |
m_lastShowPressTimestamp = 0; |
@@ -969,7 +970,13 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) |
m_frame->selection().setCaretBlinkingSuspended(true); |
- bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.innerNode(), m_clickCount, mouseEvent); |
+ bool swallowEvent = dispatchPointerEventForMouseEvent(mev.innerNode(), EventTypeNames::pointerdown, mouseEvent); |
+ if (swallowEvent) { |
+ m_preventMouseEventForPointerTypeMouse = true; |
+ } |
+ if (!m_preventMouseEventForPointerTypeMouse) |
+ swallowEvent = swallowEvent || !dispatchMouseEvent(EventTypeNames::mousedown, mev.innerNode(), m_clickCount, mouseEvent); |
+ |
// m_selectionInitiationState is initialized after dispatching mousedown |
// 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 |
@@ -1253,7 +1260,10 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) |
if (subframe && passMouseReleaseEventToSubframe(mev, subframe)) |
return true; |
- bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev.innerNode(), m_clickCount, mouseEvent); |
+ bool swallowPointerUpEvent = dispatchPointerEventForMouseEvent(mev.innerNode(), EventTypeNames::pointerup, mouseEvent); |
+ bool swallowMouseUpEvent = false; |
Rick Byers
2015/10/20 19:09:50
I think there can be cases where blink doesn't dir
mustaq
2015/10/21 15:17:21
Yes, this is dependent on Lan's work. Filed crbug/
mustaq
2015/10/22 16:42:52
Here is a patch that resets the "prevent-ME" state
Rick Byers
2015/10/22 21:31:51
I played with edge a bit here. To match their beh
|
+ if (!m_preventMouseEventForPointerTypeMouse) |
+ swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev.innerNode(), m_clickCount, mouseEvent); |
bool contextMenuEvent = mouseEvent.button() == RightButton; |
#if OS(MACOSX) |
@@ -1280,12 +1290,13 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) |
} |
bool swallowMouseReleaseEvent = false; |
- if (!swallowMouseUpEvent) |
+ if (!swallowPointerUpEvent && !swallowMouseUpEvent) |
swallowMouseReleaseEvent = handleMouseReleaseEvent(mev); |
invalidateClick(); |
- return swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent; |
+ m_preventMouseEventForPointerTypeMouse = false; |
+ return swallowPointerUpEvent || swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent; |
} |
bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTarget, const PlatformMouseEvent& event, DataTransfer* dataTransfer) |