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

Unified Diff: third_party/WebKit/Source/core/events/PointerEventFactory.cpp

Issue 1892653003: Extract touch handling logic from EventHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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/events/PointerEventFactory.cpp
diff --git a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
index e937a8322f51c209099fab182c0e7ead2f34ddab..b71351e3c713fbf42718798d2995bdbefee3b578 100644
--- a/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
+++ b/third_party/WebKit/Source/core/events/PointerEventFactory.cpp
@@ -4,6 +4,8 @@
#include "core/events/PointerEventFactory.h"
+#include "platform/geometry/FloatSize.h"
+
namespace blink {
namespace {
@@ -130,8 +132,8 @@ PointerEvent* PointerEventFactory::create(
PointerEvent* PointerEventFactory::create(const AtomicString& type,
const PlatformTouchPoint& touchPoint, PlatformEvent::Modifiers modifiers,
- const double width, const double height,
- const double clientX, const double clientY)
+ const FloatSize& pointRadius,
+ const FloatPoint& pagePoint)
{
const PlatformTouchPoint::TouchState pointState = touchPoint.state();
@@ -149,14 +151,14 @@ PointerEvent* PointerEventFactory::create(const AtomicString& type,
setIdTypeButtons(pointerEventInit, touchPoint.pointerProperties(),
pointerReleasedOrCancelled ? 0 : 1);
- pointerEventInit.setWidth(width);
- pointerEventInit.setHeight(height);
+ pointerEventInit.setWidth(pointRadius.width());
+ pointerEventInit.setHeight(pointRadius.height());
pointerEventInit.setTiltX(touchPoint.pointerProperties().tiltX);
pointerEventInit.setTiltY(touchPoint.pointerProperties().tiltY);
pointerEventInit.setScreenX(touchPoint.screenPos().x());
pointerEventInit.setScreenY(touchPoint.screenPos().y());
- pointerEventInit.setClientX(clientX);
- pointerEventInit.setClientY(clientY);
+ pointerEventInit.setClientX(pagePoint.x());
+ pointerEventInit.setClientY(pagePoint.y());
pointerEventInit.setButton(pointerPressedOrReleased ? LeftButton: NoButton);
pointerEventInit.setPressure(getPointerEventPressure(
touchPoint.force(), pointerEventInit.buttons()));
@@ -351,4 +353,16 @@ bool PointerEventFactory::isActiveButtonsState(const int pointerId)
&& m_pointerIdMapping.get(pointerId).isActiveButtons;
}
+int PointerEventFactory::getPointerEventId(
+ const WebPointerProperties& properties)
+{
+ if (properties.pointerType
+ == WebPointerProperties::PointerType::Mouse)
+ return PointerEventFactory::s_mouseId;
+ IncomingId id(properties.pointerType, properties.id);
+ if (m_pointerIncomingIdMapping.contains(id))
+ return m_pointerIncomingIdMapping.get(id);
+ return PointerEventFactory::s_invalidId;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698