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 27 matching lines...) Expand all Loading... |
38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class LocalFrame; | 42 class LocalFrame; |
43 | 43 |
44 class CORE_EXPORT Touch final : public RefCountedWillBeGarbageCollected<Touch>,
public ScriptWrappable { | 44 class CORE_EXPORT Touch final : public RefCountedWillBeGarbageCollected<Touch>,
public ScriptWrappable { |
45 DEFINE_WRAPPERTYPEINFO(); | 45 DEFINE_WRAPPERTYPEINFO(); |
46 public: | 46 public: |
47 static PassRefPtrWillBeRawPtr<Touch> create(LocalFrame* frame, EventTarget*
target, | 47 static PassRefPtrWillBeRawPtr<Touch> create(LocalFrame* frame, EventTarget*
target, |
48 unsigned identifier, const FloatPoint& screenPos, const FloatPoint& page
Pos, | 48 int identifier, const FloatPoint& screenPos, const FloatPoint& pagePos, |
49 const FloatSize& radius, float rotationAngle, float force) | 49 const FloatSize& radius, float rotationAngle, float force) |
50 { | 50 { |
51 return adoptRefWillBeNoop( | 51 return adoptRefWillBeNoop( |
52 new Touch(frame, target, identifier, screenPos, pagePos, radius, rot
ationAngle, force)); | 52 new Touch(frame, target, identifier, screenPos, pagePos, radius, rot
ationAngle, force)); |
53 } | 53 } |
54 | 54 |
55 // DOM Touch implementation | 55 // DOM Touch implementation |
56 EventTarget* target() const { return m_target.get(); } | 56 EventTarget* target() const { return m_target.get(); } |
57 unsigned identifier() const { return m_identifier; } | 57 int identifier() const { return m_identifier; } |
58 double clientX() const { return m_clientPos.x(); } | 58 double clientX() const { return m_clientPos.x(); } |
59 double clientY() const { return m_clientPos.y(); } | 59 double clientY() const { return m_clientPos.y(); } |
60 double screenX() const { return m_screenPos.x(); } | 60 double screenX() const { return m_screenPos.x(); } |
61 double screenY() const { return m_screenPos.y(); } | 61 double screenY() const { return m_screenPos.y(); } |
62 double pageX() const { return m_pagePos.x(); } | 62 double pageX() const { return m_pagePos.x(); } |
63 double pageY() const { return m_pagePos.y(); } | 63 double pageY() const { return m_pagePos.y(); } |
64 float radiusX() const { return m_radius.width(); } | 64 float radiusX() const { return m_radius.width(); } |
65 float radiusY() const { return m_radius.height(); } | 65 float radiusY() const { return m_radius.height(); } |
66 float rotationAngle() const { return m_rotationAngle; } | 66 float rotationAngle() const { return m_rotationAngle; } |
67 float force() const { return m_force; } | 67 float force() const { return m_force; } |
68 | 68 |
69 // Blink-internal methods | 69 // Blink-internal methods |
70 const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; } | 70 const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; } |
71 const FloatPoint& screenLocation() const { return m_screenPos; } | 71 const FloatPoint& screenLocation() const { return m_screenPos; } |
72 PassRefPtrWillBeRawPtr<Touch> cloneWithNewTarget(EventTarget*) const; | 72 PassRefPtrWillBeRawPtr<Touch> cloneWithNewTarget(EventTarget*) const; |
73 | 73 |
74 DECLARE_TRACE(); | 74 DECLARE_TRACE(); |
75 | 75 |
76 private: | 76 private: |
77 Touch(LocalFrame* frame, EventTarget* target, unsigned identifier, | 77 Touch(LocalFrame*, EventTarget*, int identifier, |
78 const FloatPoint& screenPos, const FloatPoint& pagePos, | 78 const FloatPoint& screenPos, const FloatPoint& pagePos, |
79 const FloatSize& radius, float rotationAngle, float force); | 79 const FloatSize& radius, float rotationAngle, float force); |
80 | 80 |
81 Touch(EventTarget*, unsigned identifier, const FloatPoint& clientPos, | 81 Touch(EventTarget*, int identifier, const FloatPoint& clientPos, |
82 const FloatPoint& screenPos, const FloatPoint& pagePos, | 82 const FloatPoint& screenPos, const FloatPoint& pagePos, |
83 const FloatSize& radius, float rotationAngle, float force, LayoutPoint a
bsoluteLocation); | 83 const FloatSize& radius, float rotationAngle, float force, LayoutPoint a
bsoluteLocation); |
84 | 84 |
85 RefPtrWillBeMember<EventTarget> m_target; | 85 RefPtrWillBeMember<EventTarget> m_target; |
86 unsigned m_identifier; | 86 int m_identifier; |
87 // Position relative to the viewport in CSS px. | 87 // Position relative to the viewport in CSS px. |
88 FloatPoint m_clientPos; | 88 FloatPoint m_clientPos; |
89 // Position relative to the screen in DIPs. | 89 // Position relative to the screen in DIPs. |
90 FloatPoint m_screenPos; | 90 FloatPoint m_screenPos; |
91 // Position relative to the page in CSS px. | 91 // Position relative to the page in CSS px. |
92 FloatPoint m_pagePos; | 92 FloatPoint m_pagePos; |
93 // Radius in CSS px. | 93 // Radius in CSS px. |
94 FloatSize m_radius; | 94 FloatSize m_radius; |
95 float m_rotationAngle; | 95 float m_rotationAngle; |
96 float m_force; | 96 float m_force; |
97 // FIXME(rbyers): Shouldn't we be able to migrate callers to relying on scre
enPos, pagePos | 97 // 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 | 98 // or clientPos? absoluteLocation appears to be the same as pagePos but with
out browser |
99 // scale applied. | 99 // scale applied. |
100 LayoutPoint m_absoluteLocation; | 100 LayoutPoint m_absoluteLocation; |
101 }; | 101 }; |
102 | 102 |
103 } // namespace blink | 103 } // namespace blink |
104 | 104 |
105 #endif // Touch_h | 105 #endif // Touch_h |
OLD | NEW |