Chromium Code Reviews| Index: third_party/WebKit/Source/core/input/PointerEventManager.cpp |
| diff --git a/third_party/WebKit/Source/core/input/PointerEventManager.cpp b/third_party/WebKit/Source/core/input/PointerEventManager.cpp |
| index 3c531206967f6627676b7db8af07cfd5a3023322..a24fc35e95afb8f3f8e11f87e4c376c082e4d488 100644 |
| --- a/third_party/WebKit/Source/core/input/PointerEventManager.cpp |
| +++ b/third_party/WebKit/Source/core/input/PointerEventManager.cpp |
| @@ -455,8 +455,6 @@ void PointerEventManager::dispatchTouchPointerEvents( |
| touchInfo.targetFrame = touchInfo.touchNode->document().frame(); |
| } |
| - WebInputEventResult result = WebInputEventResult::NotHandled; |
| - |
| // Do not send pointer events for stationary touches or null targetFrame |
| if (touchInfo.touchNode && touchInfo.targetFrame |
| && touchPoint.state() != PlatformTouchPoint::TouchStationary |
| @@ -475,15 +473,22 @@ void PointerEventManager::dispatchTouchPointerEvents( |
| touchInfo.touchNode ? |
| touchInfo.touchNode->document().domWindow() : nullptr); |
| - result = sendTouchPointerEvent(touchInfo.touchNode, pointerEvent); |
| - } |
| - // TODO(crbug.com/507408): Right now we add the touch point only if |
| - // its pointer event is NotHandled (e.g. preventDefault is called in |
| - // the pointer event listener). This behavior needs to change as it |
| - // may create some inconsistent touch event sequence. |
| - if (result == WebInputEventResult::NotHandled) { |
| - touchInfos.append(touchInfo); |
| + WebInputEventResult result = sendTouchPointerEvent(touchInfo.touchNode, pointerEvent); |
| + |
| + // If a pointerdown has been canceled, queue the unique id to allow |
| + // suppressing mouse events from gesture events. For mouse events |
| + // fired from GestureTap & GestureLongPress (which are triggered by |
| + // single touches only), it is enough to queue the ids only for |
| + // primary pointers. |
| + // TODO(mustaq): What about other cases (e.g. GestureTwoFingerTap)? |
| + if (result != WebInputEventResult::NotHandled |
| + && pointerEvent->type() == EventTypeNames::pointerdown |
| + && pointerEvent->isPrimary()) { |
| + m_touchIdsForCanceledPointerdowns.append(event.uniqueTouchEventId()); |
| + } |
| } |
| + |
| + touchInfos.append(touchInfo); |
| } |
| } |
| @@ -599,6 +604,7 @@ void PointerEventManager::clear() |
| m_touchEventManager.clear(); |
| m_inCanceledStateForPointerTypeTouch = false; |
| m_pointerEventFactory.clear(); |
| + m_touchIdsForCanceledPointerdowns.clear(); |
| m_nodeUnderPointer.clear(); |
| m_pointerCaptureTarget.clear(); |
| m_pendingPointerCaptureTarget.clear(); |
| @@ -774,6 +780,19 @@ bool PointerEventManager::isAnyTouchActive() const |
| return m_touchEventManager.isAnyTouchActive(); |
| } |
| +bool PointerEventManager::primaryPointerdownCanceled(uint32_t uniqueTouchEventId) |
| +{ |
| + while (!m_touchIdsForCanceledPointerdowns.isEmpty()) { |
| + uint32_t firstId = m_touchIdsForCanceledPointerdowns.first(); |
| + if (firstId > uniqueTouchEventId) |
|
Rick Byers
2016/06/03 16:20:44
Oh, I didn't realize these are required to be mono
mustaq
2016/06/03 20:34:45
Clarified the existing comment in WebTouchEvent.
|
| + return false; |
| + m_touchIdsForCanceledPointerdowns.takeFirst(); |
| + if (firstId == uniqueTouchEventId) |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| DEFINE_TRACE(PointerEventManager) |
| { |
| visitor->trace(m_frame); |