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

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: Fix EXPECT_EQ compilation error on Android Created 5 years 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
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ff2da3c7ddce57cf5d8692c008262b125df98929..83b07ef2711c51e781cb2eacdafbc9a573cb863f 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -374,7 +374,7 @@ void EventHandler::clear()
m_lastGestureScrollOverWidget = false;
m_scrollbarHandlingScrollGesture = nullptr;
m_touchPressed = false;
- m_pointerIdManager.clear();
+ m_pointerEventFactory.clear();
m_preventMouseEventForPointerTypeMouse = false;
m_inPointerCanceledState = false;
m_mouseDownMayStartDrag = false;
@@ -1618,7 +1618,7 @@ bool EventHandler::dispatchPointerEvent(Node* target, const AtomicString& eventT
if (!RuntimeEnabledFeatures::pointerEventEnabled())
return false;
- RefPtrWillBeRawPtr<PointerEvent> pointerEvent = PointerEvent::create(eventType, true,
+ RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventFactory.create(eventType,
mouseEvent, relatedTarget, m_frame->document()->domWindow());
target->dispatchEvent(pointerEvent.get());
return pointerEvent->defaultPrevented() || pointerEvent->defaultHandled();
@@ -3654,22 +3654,17 @@ void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event,
for (unsigned i = 0; i < touchInfos.size(); ++i) {
TouchInfo& touchInfo = touchInfos[i];
const PlatformTouchPoint& touchPoint = touchInfo.point;
- const unsigned& pointerId = touchPoint.id();
const PlatformTouchPoint::State pointState = touchPoint.state();
+
if (pointState == PlatformTouchPoint::TouchStationary || !touchInfo.knownTarget)
continue;
bool pointerReleasedOrCancelled = pointState == PlatformTouchPoint::TouchReleased
|| pointState == PlatformTouchPoint::TouchCancelled;
- const WebPointerProperties::PointerType pointerType = touchPoint.pointerProperties().pointerType;
-
- if (pointState == PlatformTouchPoint::TouchPressed)
- m_pointerIdManager.add(pointerType, pointerId);
- RefPtrWillBeRawPtr<PointerEvent> pointerEvent = PointerEvent::create(
+ RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventFactory.create(
pointerEventNameForTouchPointState(pointState),
- m_pointerIdManager.isPrimary(pointerType, pointerId),
touchPoint, event.modifiers(),
touchInfo.adjustedRadius.width(), touchInfo.adjustedRadius.height(),
touchInfo.adjustedPagePoint.x(), touchInfo.adjustedPagePoint.y());
@@ -3679,7 +3674,7 @@ void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event,
// Remove the released/cancelled id at the end to correctly determine primary id above.
if (pointerReleasedOrCancelled)
- m_pointerIdManager.remove(pointerType, pointerId);
+ m_pointerEventFactory.remove(pointerEvent);
}
}
@@ -3691,23 +3686,16 @@ void EventHandler::sendPointerCancels(WillBeHeapVector<TouchInfo>& touchInfos)
for (unsigned i = 0; i < touchInfos.size(); ++i) {
TouchInfo& touchInfo = touchInfos[i];
const PlatformTouchPoint& point = touchInfo.point;
- const unsigned& pointerId = point.id();
const PlatformTouchPoint::State pointState = point.state();
if (pointState == PlatformTouchPoint::TouchReleased
|| pointState == PlatformTouchPoint::TouchCancelled)
continue;
- PointerEventInit pointerEventInit;
- pointerEventInit.setPointerId(pointerId);
- pointerEventInit.setBubbles(true);
- pointerEventInit.setCancelable(false);
-
- RefPtrWillBeRawPtr<PointerEvent> pointerEvent = PointerEvent::create(
- EventTypeNames::pointercancel, pointerEventInit);
+ RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventFactory.createPointerCancel(point);
touchInfo.touchTarget->dispatchEvent(pointerEvent.get());
- m_pointerIdManager.remove(WebPointerProperties::PointerType::Touch, pointerId);
+ m_pointerEventFactory.remove(pointerEvent);
}
}
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698