Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Unified Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1426643008: Cleaning up PointerIdManager and add id re-mapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
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));
}
}

Powered by Google App Engine
This is Rietveld 408576698