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 f784bbcc17891a48cdfd2f466996e4e401ae6b86..fe079275e86c0d2a4236971fc6d908811160a727 100644 |
| --- a/third_party/WebKit/Source/core/input/PointerEventManager.cpp |
| +++ b/third_party/WebKit/Source/core/input/PointerEventManager.cpp |
| @@ -283,26 +283,45 @@ void PointerEventManager::setNodeUnderPointer( |
| } |
| } |
| -void PointerEventManager::sendTouchCancelPointerEvent(EventTarget* target, const PlatformTouchPoint& point) |
| +void PointerEventManager::blockTouchPointers() |
| { |
| - PointerEvent* pointerEvent = m_pointerEventFactory.createPointerCancelEvent(point); |
| + if (m_inCanceledStateForPointerTypeTouch) |
| + return; |
| + m_inCanceledStateForPointerTypeTouch = true; |
| + HeapVector<int> touchPointerIds |
| + = m_pointerEventFactory.getPointerIdsOfType(WebPointerProperties::PointerType::Touch); |
| - processCaptureAndPositionOfPointerEvent(pointerEvent, target); |
| + for (int pointerId : touchPointerIds) { |
| + PointerEvent* pointerEvent |
| + = m_pointerEventFactory.createPointerCancelEvent( |
| + pointerId, WebPointerProperties::PointerType::Touch); |
| - // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing vs pointer event capturing |
| - dispatchPointerEvent( |
| - getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), |
| - pointerEvent); |
| + ASSERT(m_nodeUnderPointer.contains(pointerId)); |
| + EventTarget* target = m_nodeUnderPointer.get(pointerId).target; |
| - releasePointerCapture(pointerEvent->pointerId()); |
| + processCaptureAndPositionOfPointerEvent(pointerEvent, target); |
| + |
| + // TODO(crbug.com/579553): This event follows implicit TE capture. The actual target |
|
bokan
2016/04/11 22:22:00
Please keep the TODO format from before: |TODO(nam
mustaq
2016/04/12 17:16:14
My interpretation of the Blink style guide entry (
|
| + // would depend on PE capturing. Perhaps need to split TE/PE event path upstream? |
| + dispatchPointerEvent( |
| + getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), |
| + pointerEvent); |
| + |
| + releasePointerCapture(pointerEvent->pointerId()); |
| + |
| + // Sending the leave/out events and lostpointercapture |
| + // because the next touch event will have a different id. So delayed |
| + // sending of lostpointercapture won't work here. |
| + processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr); |
| - // Sending the leave/out events and lostpointercapture |
| - // because the next touch event will have a different id. So delayed |
| - // sending of lostpointercapture won't work here. |
| - processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr); |
| + removePointer(pointerEvent); |
| + } |
| +} |
| - removePointer(pointerEvent); |
| +void PointerEventManager::unblockTouchPointers() |
| +{ |
| + m_inCanceledStateForPointerTypeTouch = false; |
| } |
| WebInputEventResult PointerEventManager::sendTouchPointerEvent( |
| @@ -311,6 +330,9 @@ WebInputEventResult PointerEventManager::sendTouchPointerEvent( |
| const double width, const double height, |
| const double clientX, const double clientY) |
| { |
| + if (m_inCanceledStateForPointerTypeTouch) |
| + return WebInputEventResult::NotHandled; |
| + |
| PointerEvent* pointerEvent = |
| m_pointerEventFactory.create( |
| pointerEventNameForTouchPointState(touchPoint.state()), |
| @@ -398,6 +420,7 @@ PointerEventManager::~PointerEventManager() |
| void PointerEventManager::clear() |
| { |
| m_preventMouseEventForPointerTypeMouse = false; |
| + m_inCanceledStateForPointerTypeTouch = false; |
| m_pointerEventFactory.clear(); |
| m_nodeUnderPointer.clear(); |
| m_pointerCaptureTarget.clear(); |
| @@ -527,8 +550,8 @@ EventTarget* PointerEventManager::getCapturingNode(int pointerId) |
| void PointerEventManager::removePointer( |
| PointerEvent* pointerEvent) |
| { |
| - if (m_pointerEventFactory.remove(pointerEvent)) { |
| - int pointerId = pointerEvent->pointerId(); |
| + int pointerId = pointerEvent->pointerId(); |
| + if (m_pointerEventFactory.remove(pointerId)) { |
| m_pendingPointerCaptureTarget.remove(pointerId); |
| m_pointerCaptureTarget.remove(pointerId); |
| m_nodeUnderPointer.remove(pointerId); |