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 0f681c7c1dd8cc2472fcb137aeeebea4d98091ad..cbd4c6e33ffec5434d3abead6cd5159f41d4ffdc 100644 |
| --- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
| +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| @@ -1619,7 +1619,8 @@ bool EventHandler::dispatchPointerEvent(Node* target, const AtomicString& eventT |
| return false; |
| RefPtrWillBeRawPtr<PointerEvent> pointerEvent = PointerEvent::create(eventType, true, |
| - mouseEvent, relatedTarget, m_frame->document()->domWindow()); |
| + mouseEvent, relatedTarget, m_frame->document()->domWindow(), |
| + m_pointerIdManager.getPrimaryId(WebPointerProperties::PointerType::Mouse)); |
| target->dispatchEvent(pointerEvent.get()); |
| return pointerEvent->defaultPrevented() || pointerEvent->defaultHandled(); |
| } |
| @@ -3656,6 +3657,7 @@ void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event, |
| const unsigned& pointerId = touchPoint.id(); |
| const PlatformTouchPoint::State pointState = touchPoint.state(); |
| + |
| if (pointState == PlatformTouchPoint::TouchStationary || !touchInfo.knownTarget) |
| continue; |
| @@ -3663,22 +3665,24 @@ void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event, |
| || pointState == PlatformTouchPoint::TouchCancelled; |
| const WebPointerProperties::PointerType pointerType = touchPoint.pointerProperties().pointerType; |
| - if (pointState == PlatformTouchPoint::TouchPressed) |
| - m_pointerIdManager.add(pointerType, pointerId); |
| + // The id gets added the first time we call add which should TouchPressed |
| + // and the consecutive calls with the same GeneratedPointer will return the same MappedId. |
| + const PointerIdManager::MappedId mappedId = m_pointerIdManager.add(PointerIdManager::GeneratedPointer(pointerType, pointerId)); |
|
mustaq
2015/11/20 20:13:53
This looks good. One concern is that EventHandler
Navid Zolghadr
2015/11/20 20:32:22
Then maybe in this case we can change PointerIdMan
|
| RefPtrWillBeRawPtr<PointerEvent> pointerEvent = PointerEvent::create( |
| pointerEventNameForTouchPointState(pointState), |
| - m_pointerIdManager.isPrimary(pointerType, pointerId), |
| + m_pointerIdManager.isPrimary(mappedId), |
| touchPoint, event.modifiers(), |
| touchInfo.adjustedRadius.width(), touchInfo.adjustedRadius.height(), |
| - touchInfo.adjustedPagePoint.x(), touchInfo.adjustedPagePoint.y()); |
| + touchInfo.adjustedPagePoint.x(), touchInfo.adjustedPagePoint.y(), |
| + mappedId); |
| touchInfo.touchTarget->dispatchEvent(pointerEvent.get()); |
| touchInfo.consumed = pointerEvent->defaultPrevented() || pointerEvent->defaultHandled(); |
| // Remove the released/cancelled id at the end to correctly determine primary id above. |
| if (pointerReleasedOrCancelled) |
| - m_pointerIdManager.remove(pointerType, pointerId); |
| + m_pointerIdManager.remove(mappedId); |
| } |
| } |
| @@ -3706,7 +3710,7 @@ void EventHandler::sendPointerCancels(WillBeHeapVector<TouchInfo>& touchInfos) |
| EventTypeNames::pointercancel, pointerEventInit); |
| touchInfo.touchTarget->dispatchEvent(pointerEvent.get()); |
| - m_pointerIdManager.remove(WebPointerProperties::PointerType::Touch, pointerId); |
| + m_pointerIdManager.remove(PointerIdManager::GeneratedPointer(WebPointerProperties::PointerType::Touch, pointerId)); |
| } |
| } |