Chromium Code Reviews| 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 e74232868b513f12cc312a879e5c8d85f7599b50..c7871065c1d6209a30509fedf4a8b7e700d22ac4 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())); |
| @@ -309,7 +311,8 @@ bool PointerEventFactory::remove(const int mappedId) |
| return true; |
| } |
| -Vector<int> PointerEventFactory::getPointerIdsOfType(WebPointerProperties::PointerType pointerType) |
| +Vector<int> PointerEventFactory::getPointerIdsOfType( |
| + WebPointerProperties::PointerType pointerType) const |
| { |
| Vector<int> mappedIds; |
| @@ -334,7 +337,7 @@ bool PointerEventFactory::isPrimary(int mappedId) const |
| } |
| WebPointerProperties::PointerType PointerEventFactory::getPointerType( |
| - const int pointerId) |
| + const int pointerId) const |
| { |
| if (m_pointerIdMapping.contains(pointerId)) { |
| return static_cast<WebPointerProperties::PointerType>( |
| @@ -343,15 +346,27 @@ WebPointerProperties::PointerType PointerEventFactory::getPointerType( |
| return WebPointerProperties::PointerType::Unknown; |
| } |
| -bool PointerEventFactory::isActive(const int pointerId) |
| +bool PointerEventFactory::isActive(const int pointerId) const |
| { |
| return m_pointerIdMapping.contains(pointerId); |
| } |
| -bool PointerEventFactory::isActiveButtonsState(const int pointerId) |
| +bool PointerEventFactory::isActiveButtonsState(const int pointerId) const |
| { |
| return m_pointerIdMapping.contains(pointerId) |
| && m_pointerIdMapping.get(pointerId).isActiveButtons; |
| } |
| +int PointerEventFactory::getPointerEventId( |
| + const WebPointerProperties& properties) const |
|
tdresser
2016/04/29 15:55:04
Is |properties| guaranteed to be unique?
Navid Zolghadr
2016/04/29 16:31:19
There are two properties in the WebPointerProperti
mustaq
2016/04/29 17:03:05
Navid is right: it is reasonable to assume that lo
|
| +{ |
| + 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 |