| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008, The Android Open Source Project | 2 * Copyright 2008, The Android Open Source Project |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * * Redistributions of source code must retain the above copyright | 7 * * Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * * Redistributions in binary form must reproduce the above copyright | 9 * * Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef Touch_h | 26 #ifndef Touch_h |
| 27 #define Touch_h | 27 #define Touch_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScriptWrappable.h" | 29 #include "bindings/core/v8/ScriptWrappable.h" |
| 30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "core/dom/Document.h" |
| 32 #include "core/dom/TouchInit.h" |
| 31 #include "core/events/EventTarget.h" | 33 #include "core/events/EventTarget.h" |
| 32 #include "platform/geometry/FloatPoint.h" | 34 #include "platform/geometry/FloatPoint.h" |
| 33 #include "platform/geometry/FloatSize.h" | 35 #include "platform/geometry/FloatSize.h" |
| 34 #include "platform/geometry/LayoutPoint.h" | 36 #include "platform/geometry/LayoutPoint.h" |
| 35 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 36 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
| 37 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 38 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 39 | 41 |
| 40 namespace blink { | 42 namespace blink { |
| 41 | 43 |
| 42 class LocalFrame; | 44 class LocalFrame; |
| 43 | 45 |
| 44 class CORE_EXPORT Touch final : public RefCountedWillBeGarbageCollected<Touch>,
public ScriptWrappable { | 46 class CORE_EXPORT Touch final : public RefCountedWillBeGarbageCollected<Touch>,
public ScriptWrappable { |
| 45 DEFINE_WRAPPERTYPEINFO(); | 47 DEFINE_WRAPPERTYPEINFO(); |
| 46 public: | 48 public: |
| 47 static PassRefPtrWillBeRawPtr<Touch> create(LocalFrame* frame, EventTarget*
target, | 49 static PassRefPtrWillBeRawPtr<Touch> create(LocalFrame* frame, EventTarget*
target, |
| 48 int identifier, const FloatPoint& screenPos, const FloatPoint& pagePos, | 50 int identifier, const FloatPoint& screenPos, const FloatPoint& pagePos, |
| 49 const FloatSize& radius, float rotationAngle, float force) | 51 const FloatSize& radius, float rotationAngle, float force) |
| 50 { | 52 { |
| 51 return adoptRefWillBeNoop( | 53 return adoptRefWillBeNoop( |
| 52 new Touch(frame, target, identifier, screenPos, pagePos, radius, rot
ationAngle, force)); | 54 new Touch(frame, target, identifier, screenPos, pagePos, radius, rot
ationAngle, force)); |
| 53 } | 55 } |
| 54 | 56 |
| 57 static PassRefPtrWillBeRawPtr<Touch> create(const Document& document, const
TouchInit& initializer) |
| 58 { |
| 59 return adoptRefWillBeNoop(new Touch(document.frame(), initializer)); |
| 60 } |
| 61 |
| 55 // DOM Touch implementation | 62 // DOM Touch implementation |
| 56 EventTarget* target() const { return m_target.get(); } | 63 EventTarget* target() const { return m_target.get(); } |
| 57 int identifier() const { return m_identifier; } | 64 int identifier() const { return m_identifier; } |
| 58 double clientX() const { return m_clientPos.x(); } | 65 double clientX() const { return m_clientPos.x(); } |
| 59 double clientY() const { return m_clientPos.y(); } | 66 double clientY() const { return m_clientPos.y(); } |
| 60 double screenX() const { return m_screenPos.x(); } | 67 double screenX() const { return m_screenPos.x(); } |
| 61 double screenY() const { return m_screenPos.y(); } | 68 double screenY() const { return m_screenPos.y(); } |
| 62 double pageX() const { return m_pagePos.x(); } | 69 double pageX() const { return m_pagePos.x(); } |
| 63 double pageY() const { return m_pagePos.y(); } | 70 double pageY() const { return m_pagePos.y(); } |
| 64 float radiusX() const { return m_radius.width(); } | 71 float radiusX() const { return m_radius.width(); } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 75 | 82 |
| 76 private: | 83 private: |
| 77 Touch(LocalFrame*, EventTarget*, int identifier, | 84 Touch(LocalFrame*, EventTarget*, int identifier, |
| 78 const FloatPoint& screenPos, const FloatPoint& pagePos, | 85 const FloatPoint& screenPos, const FloatPoint& pagePos, |
| 79 const FloatSize& radius, float rotationAngle, float force); | 86 const FloatSize& radius, float rotationAngle, float force); |
| 80 | 87 |
| 81 Touch(EventTarget*, int identifier, const FloatPoint& clientPos, | 88 Touch(EventTarget*, int identifier, const FloatPoint& clientPos, |
| 82 const FloatPoint& screenPos, const FloatPoint& pagePos, | 89 const FloatPoint& screenPos, const FloatPoint& pagePos, |
| 83 const FloatSize& radius, float rotationAngle, float force, LayoutPoint a
bsoluteLocation); | 90 const FloatSize& radius, float rotationAngle, float force, LayoutPoint a
bsoluteLocation); |
| 84 | 91 |
| 92 Touch(LocalFrame*, const TouchInit&); |
| 93 |
| 85 RefPtrWillBeMember<EventTarget> m_target; | 94 RefPtrWillBeMember<EventTarget> m_target; |
| 86 int m_identifier; | 95 int m_identifier; |
| 87 // Position relative to the viewport in CSS px. | 96 // Position relative to the viewport in CSS px. |
| 88 FloatPoint m_clientPos; | 97 FloatPoint m_clientPos; |
| 89 // Position relative to the screen in DIPs. | 98 // Position relative to the screen in DIPs. |
| 90 FloatPoint m_screenPos; | 99 FloatPoint m_screenPos; |
| 91 // Position relative to the page in CSS px. | 100 // Position relative to the page in CSS px. |
| 92 FloatPoint m_pagePos; | 101 FloatPoint m_pagePos; |
| 93 // Radius in CSS px. | 102 // Radius in CSS px. |
| 94 FloatSize m_radius; | 103 FloatSize m_radius; |
| 95 float m_rotationAngle; | 104 float m_rotationAngle; |
| 96 float m_force; | 105 float m_force; |
| 97 // FIXME(rbyers): Shouldn't we be able to migrate callers to relying on scre
enPos, pagePos | 106 // FIXME(rbyers): Shouldn't we be able to migrate callers to relying on scre
enPos, pagePos |
| 98 // or clientPos? absoluteLocation appears to be the same as pagePos but with
out browser | 107 // or clientPos? absoluteLocation appears to be the same as pagePos but with
out browser |
| 99 // scale applied. | 108 // scale applied. |
| 100 LayoutPoint m_absoluteLocation; | 109 LayoutPoint m_absoluteLocation; |
| 101 }; | 110 }; |
| 102 | 111 |
| 103 } // namespace blink | 112 } // namespace blink |
| 104 | 113 |
| 105 #endif // Touch_h | 114 #endif // Touch_h |
| OLD | NEW |