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