Chromium Code Reviews| Index: Source/core/dom/Touch.h |
| diff --git a/Source/core/dom/Touch.h b/Source/core/dom/Touch.h |
| index 2b86fd0ff027ac0ab12d5157faacf48ae67c4aca..d3d871a7f41cb4a7f408930260adb905cf497b14 100644 |
| --- a/Source/core/dom/Touch.h |
| +++ b/Source/core/dom/Touch.h |
| @@ -28,6 +28,8 @@ |
| #include "bindings/v8/ScriptWrappable.h" |
| #include "core/events/EventTarget.h" |
| +#include "platform/geometry/FloatPoint.h" |
| +#include "platform/geometry/FloatSize.h" |
| #include "platform/geometry/LayoutPoint.h" |
| #include "platform/heap/Handle.h" |
| #include "wtf/PassRefPtr.h" |
| @@ -41,23 +43,23 @@ class LocalFrame; |
| class Touch FINAL : public RefCountedWillBeGarbageCollectedFinalized<Touch>, public ScriptWrappable { |
| public: |
| static PassRefPtrWillBeRawPtr<Touch> create(LocalFrame* frame, EventTarget* target, |
| - unsigned identifier, int screenX, int screenY, int pageX, int pageY, |
| - int radiusX, int radiusY, float rotationAngle, float force) |
| + unsigned identifier, const FloatPoint& screenPos, const FloatPoint& pagePos, |
| + const FloatSize& radius, float rotationAngle, float force) |
| { |
| - return adoptRefWillBeNoop(new Touch(frame, target, identifier, screenX, |
| - screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force)); |
| + return adoptRefWillBeNoop( |
| + new Touch(frame, target, identifier, screenPos, pagePos, radius, rotationAngle, force)); |
| } |
| EventTarget* target() const { return m_target.get(); } |
| unsigned identifier() const { return m_identifier; } |
| - int clientX() const { return m_clientX; } |
| - int clientY() const { return m_clientY; } |
| - int screenX() const { return m_screenX; } |
| - int screenY() const { return m_screenY; } |
| - int pageX() const { return m_pageX; } |
| - int pageY() const { return m_pageY; } |
| - int webkitRadiusX() const { return m_radiusX; } |
| - int webkitRadiusY() const { return m_radiusY; } |
| + double clientX() const { return m_clientPos.x(); } |
|
eae
2014/06/06 16:23:53
You might want to use float here instead to avoid
Rick Byers
2014/06/06 17:02:43
Yeah, this is the public API which we defined in t
|
| + double clientY() const { return m_clientPos.y(); } |
| + double screenX() const { return m_screenPos.x(); } |
| + double screenY() const { return m_screenPos.y(); } |
| + double pageX() const { return m_pagePos.x(); } |
| + double pageY() const { return m_pagePos.y(); } |
| + double webkitRadiusX() const { return m_radius.width(); } |
| + double webkitRadiusY() const { return m_radius.height(); } |
| float webkitRotationAngle() const { return m_rotationAngle; } |
| float webkitForce() const { return m_force; } |
| const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; } |
| @@ -67,25 +69,28 @@ public: |
| private: |
| Touch(LocalFrame* frame, EventTarget* target, unsigned identifier, |
| - int screenX, int screenY, int pageX, int pageY, |
| - int radiusX, int radiusY, float rotationAngle, float force); |
| + const FloatPoint& screenPos, const FloatPoint& pagePos, |
| + const FloatSize& radius, float rotationAngle, float force); |
| - Touch(EventTarget*, unsigned identifier, int clientX, int clientY, |
| - int screenX, int screenY, int pageX, int pageY, |
| - int radiusX, int radiusY, float rotationAngle, float force, LayoutPoint absoluteLocation); |
| + Touch(EventTarget*, unsigned identifier, const FloatPoint& clientPos, |
| + const FloatPoint& screenPos, const FloatPoint& pagePos, |
| + const FloatSize& radius, float rotationAngle, float force, LayoutPoint absoluteLocation); |
| RefPtrWillBeMember<EventTarget> m_target; |
| unsigned m_identifier; |
| - int m_clientX; |
| - int m_clientY; |
| - int m_screenX; |
| - int m_screenY; |
| - int m_pageX; |
| - int m_pageY; |
| - int m_radiusX; |
| - int m_radiusY; |
| + // Position relative to the viewport in CSS px. |
| + FloatPoint m_clientPos; |
| + // Position relative to the screen in DIPs. |
| + FloatPoint m_screenPos; |
| + // Position relative to the page in CSS px. |
| + FloatPoint m_pagePos; |
| + // Radius in CSS px. |
| + FloatSize m_radius; |
| float m_rotationAngle; |
| float m_force; |
| + // FIXME(rbyers): Shouldn't we be able to migrate callers to relying on screenPos, pagePos |
| + // or clientPos? absoluteLocation appears to be the same as pagePos but without browser |
| + // scale applied. |
| LayoutPoint m_absoluteLocation; |
| }; |