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) |