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

Unified Diff: third_party/WebKit/Source/core/events/PointerEvent.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
Index: third_party/WebKit/Source/core/events/PointerEvent.cpp
diff --git a/third_party/WebKit/Source/core/events/PointerEvent.cpp b/third_party/WebKit/Source/core/events/PointerEvent.cpp
index d8fa92257a78a0e8734fa25ff6b53d518a073452..12021030fb65340ac38563a44369f26a4aa5b25b 100644
--- a/third_party/WebKit/Source/core/events/PointerEvent.cpp
+++ b/third_party/WebKit/Source/core/events/PointerEvent.cpp
@@ -10,105 +10,6 @@
namespace blink {
-namespace {
-
-const char* pointerTypeNameForWebPointPointerType(WebPointerProperties::PointerType type)
-{
- switch (type) {
- case WebPointerProperties::PointerType::Unknown:
- return "";
- case WebPointerProperties::PointerType::Touch:
- return "touch";
- case WebPointerProperties::PointerType::Pen:
- return "pen";
- case WebPointerProperties::PointerType::Mouse:
- return "mouse";
- }
- ASSERT_NOT_REACHED();
- return "";
-}
-
-}
-
-PassRefPtrWillBeRawPtr<PointerEvent> PointerEvent::create(const AtomicString& type,
- const bool isPrimary, const PlatformMouseEvent& mouseEvent,
- PassRefPtrWillBeRawPtr<Node> relatedTarget,
- PassRefPtrWillBeRawPtr<AbstractView> view)
-{
- PointerEventInit pointerEventInit;
-
- // TODO(crbug.com/537319): Define a constant somewhere for mouse id.
- pointerEventInit.setPointerId(0);
- pointerEventInit.setPointerType(
- pointerTypeNameForWebPointPointerType(mouseEvent.pointerProperties().pointerType));
- pointerEventInit.setIsPrimary(true);
-
- pointerEventInit.setScreenX(mouseEvent.globalPosition().x());
- pointerEventInit.setScreenY(mouseEvent.globalPosition().y());
- pointerEventInit.setClientX(mouseEvent.position().x());
- pointerEventInit.setClientY(mouseEvent.position().y());
-
- pointerEventInit.setButton(mouseEvent.button());
- pointerEventInit.setButtons(MouseEvent::platformModifiersToButtons(mouseEvent.modifiers()));
-
- pointerEventInit.setPressure(mouseEvent.pointerProperties().force);
- pointerEventInit.setTiltX(mouseEvent.pointerProperties().tiltX);
- pointerEventInit.setTiltY(mouseEvent.pointerProperties().tiltY);
-
- UIEventWithKeyState::setFromPlatformModifiers(pointerEventInit, mouseEvent.modifiers());
-
- pointerEventInit.setBubbles(type != EventTypeNames::pointerenter
- && type != EventTypeNames::pointerleave);
- pointerEventInit.setCancelable(type != EventTypeNames::pointerenter
- && type != EventTypeNames::pointerleave && type != EventTypeNames::pointercancel);
-
- pointerEventInit.setView(view);
- if (relatedTarget)
- pointerEventInit.setRelatedTarget(relatedTarget);
-
- return PointerEvent::create(type, pointerEventInit);
-}
-
-PassRefPtrWillBeRawPtr<PointerEvent> PointerEvent::create(const AtomicString& type,
- const bool isPrimary, const PlatformTouchPoint& touchPoint,
- PlatformEvent::Modifiers modifiers,
- const double width, const double height,
- const double clientX, const double clientY)
-{
- const unsigned& pointerId = touchPoint.id();
- const PlatformTouchPoint::State pointState = touchPoint.state();
-
- bool pointerReleasedOrCancelled = pointState == PlatformTouchPoint::TouchReleased
- || pointState == PlatformTouchPoint::TouchCancelled;
-
- bool isEnterOrLeave = false;
-
- PointerEventInit pointerEventInit;
- pointerEventInit.setPointerId(pointerId);
- pointerEventInit.setPointerType(
- pointerTypeNameForWebPointPointerType(touchPoint.pointerProperties().pointerType));
- pointerEventInit.setIsPrimary(isPrimary);
-
- pointerEventInit.setWidth(width);
- pointerEventInit.setHeight(height);
- pointerEventInit.setPressure(touchPoint.force());
- 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.setButton(0);
- pointerEventInit.setButtons(pointerReleasedOrCancelled ? 0 : 1);
-
- UIEventWithKeyState::setFromPlatformModifiers(pointerEventInit, modifiers);
-
- pointerEventInit.setBubbles(!isEnterOrLeave);
- pointerEventInit.setCancelable(!isEnterOrLeave && pointState != PlatformTouchPoint::TouchCancelled);
-
- return PointerEvent::create(type, pointerEventInit);
-}
-
PointerEvent::PointerEvent()
: m_pointerId(0)
, m_width(0)
« no previous file with comments | « third_party/WebKit/Source/core/events/PointerEvent.h ('k') | third_party/WebKit/Source/core/events/PointerEventFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698