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 f3b1dd0d0c524ebcbd722ae74953040dbedbd00b..855b2abab2d74538e54544cc0c89a45b6b313fab 100644 |
| --- a/third_party/WebKit/Source/core/input/PointerEventManager.cpp |
| +++ b/third_party/WebKit/Source/core/input/PointerEventManager.cpp |
| @@ -169,14 +169,6 @@ WebInputEventResult PointerEventManager::dispatchPointerEvent( |
| UseCounter::count(m_frame->document(), |
| UseCounter::PointerEventDispatchPointerDown); |
| - std::unique_ptr<UserGestureIndicator> gestureIndicator; |
| - if (eventType == EventTypeNames::pointerup && |
| - pointerEvent->pointerType() == "touch") { |
| - gestureIndicator = |
| - wrapUnique(new UserGestureIndicator(DocumentUserGestureToken::create( |
| - target->toNode() ? &target->toNode()->document() : nullptr))); |
| - } |
| - |
| DispatchEventResult dispatchResult = target->dispatchEvent(pointerEvent); |
| return EventHandlingUtil::toWebInputEventResult(dispatchResult); |
| } |
| @@ -298,7 +290,6 @@ WebInputEventResult PointerEventManager::handleTouchEvents( |
| const PlatformTouchEvent& event) { |
| if (event.type() == PlatformEvent::TouchScrollStarted) { |
| blockTouchPointers(); |
| - m_touchEventManager->setTouchScrollStarted(); |
| return WebInputEventResult::HandledSystem; |
| } |
| @@ -311,18 +302,32 @@ WebInputEventResult PointerEventManager::handleTouchEvents( |
| } |
| if (newTouchSequence) |
| unblockTouchPointers(); |
| + |
| + // Do any necessary hit-tests and compute the event targets for all pointers |
| + // in the event. |
| HeapVector<TouchEventManager::TouchInfo> touchInfos; |
| + computeTouchTargets(event, touchInfos); |
| + |
| + // A finger lifting is a user gesture only when it wasn't associated with a |
| + // scroll. |
| + // Re-use the same UserGesture for touchend and pointerup. |
| + // https://docs.google.com/document/d/1oF1T3O7_E4t1PYHV6gyCwHxOi3ystm0eSL5xZu7nvOg/edit# |
| + RefPtr<UserGestureToken> possibleGestureToken; |
| + if (event.type() == PlatformEvent::TouchEnd && |
| + !m_inCanceledStateForPointerTypeTouch) { |
| + possibleGestureToken = |
| + DocumentUserGestureToken::create(touchInfos[0].targetFrame->document()); |
|
Navid Zolghadr
2016/11/04 18:08:19
I'm a little confused about the intended behavior
|
| + } |
| + UserGestureIndicator holder(possibleGestureToken); |
| dispatchTouchPointerEvents(event, touchInfos); |
| return m_touchEventManager->handleTouchEvent(event, touchInfos); |
| } |
| -void PointerEventManager::dispatchTouchPointerEvents( |
| +void PointerEventManager::computeTouchTargets( |
| const PlatformTouchEvent& event, |
| HeapVector<TouchEventManager::TouchInfo>& touchInfos) { |
| - // Iterate through the touch points, sending PointerEvents to the targets as |
| - // required. |
| for (const auto& touchPoint : event.touchPoints()) { |
| TouchEventManager::TouchInfo touchInfo; |
| touchInfo.point = touchPoint; |
| @@ -373,6 +378,17 @@ void PointerEventManager::dispatchTouchPointerEvents( |
| touchInfo.targetFrame = touchInfo.touchNode->document().frame(); |
| } |
| + touchInfos.append(touchInfo); |
| + } |
| +} |
| + |
| +void PointerEventManager::dispatchTouchPointerEvents( |
| + const PlatformTouchEvent& event, |
| + HeapVector<TouchEventManager::TouchInfo>& touchInfos) { |
| + // Iterate through the touch points, sending PointerEvents to the targets as |
| + // required. |
| + for (auto touchInfo : touchInfos) { |
| + const PlatformTouchPoint& touchPoint = touchInfo.point; |
| // Do not send pointer events for stationary touches or null targetFrame |
| if (touchInfo.touchNode && touchInfo.targetFrame && |
| touchPoint.state() != PlatformTouchPoint::TouchStationary && |
| @@ -405,8 +421,6 @@ void PointerEventManager::dispatchTouchPointerEvents( |
| m_touchIdsForCanceledPointerdowns.append(event.uniqueTouchEventId()); |
| } |
| } |
| - |
| - touchInfos.append(touchInfo); |
| } |
| } |