OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008, The Android Open Source Project | 2 * Copyright 2008, The Android Open Source Project |
3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. | 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above copyright | 10 * * Redistributions in binary form must reproduce the above copyright |
(...skipping 10 matching lines...) Expand all Loading... |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef TouchEvent_h | 27 #ifndef TouchEvent_h |
28 #define TouchEvent_h | 28 #define TouchEvent_h |
29 | 29 |
30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "core/dom/TouchList.h" |
31 #include "core/events/EventDispatchMediator.h" | 32 #include "core/events/EventDispatchMediator.h" |
32 #include "core/events/MouseRelatedEvent.h" | 33 #include "core/events/MouseRelatedEvent.h" |
33 #include "core/dom/TouchList.h" | 34 #include "core/events/TouchEventInit.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 class CORE_EXPORT TouchEvent final : public UIEventWithKeyState { | 38 class CORE_EXPORT TouchEvent final : public UIEventWithKeyState { |
38 DEFINE_WRAPPERTYPEINFO(); | 39 DEFINE_WRAPPERTYPEINFO(); |
39 public: | 40 public: |
40 ~TouchEvent() override; | 41 ~TouchEvent() override; |
41 | 42 |
42 // We only initialize sourceCapabilities when we create TouchEvent from Even
tHandler, null if it is from JavaScript. | 43 // We only initialize sourceCapabilities when we create TouchEvent from Even
tHandler, null if it is from JavaScript. |
43 static PassRefPtrWillBeRawPtr<TouchEvent> create() | 44 static PassRefPtrWillBeRawPtr<TouchEvent> create() |
44 { | 45 { |
45 return adoptRefWillBeNoop(new TouchEvent); | 46 return adoptRefWillBeNoop(new TouchEvent); |
46 } | 47 } |
47 static PassRefPtrWillBeRawPtr<TouchEvent> create(TouchList* touches, | 48 static PassRefPtrWillBeRawPtr<TouchEvent> create(TouchList* touches, |
48 TouchList* targetTouches, TouchList* changedTouches, | 49 TouchList* targetTouches, TouchList* changedTouches, |
49 const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, | 50 const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, |
50 PlatformEvent::Modifiers modifiers, bool cancelable, bool causesScrollin
gIfUncanceled, | 51 PlatformEvent::Modifiers modifiers, bool cancelable, bool causesScrollin
gIfUncanceled, |
51 double uiCreateTime = 0) | 52 double uiCreateTime = 0) |
52 { | 53 { |
53 return adoptRefWillBeNoop(new TouchEvent(touches, targetTouches, changed
Touches, type, view, | 54 return adoptRefWillBeNoop(new TouchEvent(touches, targetTouches, changed
Touches, type, view, |
54 modifiers, cancelable, causesScrollingIfUncanceled, uiCreateTime)); | 55 modifiers, cancelable, causesScrollingIfUncanceled, uiCreateTime)); |
55 } | 56 } |
56 | 57 |
| 58 static PassRefPtrWillBeRawPtr<TouchEvent> create(const AtomicString& type, c
onst TouchEventInit& initializer) |
| 59 { |
| 60 return adoptRefWillBeNoop(new TouchEvent(type, initializer)); |
| 61 } |
| 62 |
57 void initTouchEvent(ScriptState*, TouchList* touches, TouchList* targetTouch
es, | 63 void initTouchEvent(ScriptState*, TouchList* touches, TouchList* targetTouch
es, |
58 TouchList* changedTouches, const AtomicString& type, | 64 TouchList* changedTouches, const AtomicString& type, |
59 PassRefPtrWillBeRawPtr<AbstractView>, | 65 PassRefPtrWillBeRawPtr<AbstractView>, |
60 int, int, int, int, // unused useless members of web exposed API | 66 int, int, int, int, // unused useless members of web exposed API |
61 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 67 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
62 | 68 |
63 TouchList* touches() const { return m_touches.get(); } | 69 TouchList* touches() const { return m_touches.get(); } |
64 TouchList* targetTouches() const { return m_targetTouches.get(); } | 70 TouchList* targetTouches() const { return m_targetTouches.get(); } |
65 TouchList* changedTouches() const { return m_changedTouches.get(); } | 71 TouchList* changedTouches() const { return m_changedTouches.get(); } |
66 | 72 |
(...skipping 13 matching lines...) Expand all Loading... |
80 | 86 |
81 DECLARE_VIRTUAL_TRACE(); | 87 DECLARE_VIRTUAL_TRACE(); |
82 | 88 |
83 private: | 89 private: |
84 TouchEvent(); | 90 TouchEvent(); |
85 TouchEvent(TouchList* touches, TouchList* targetTouches, | 91 TouchEvent(TouchList* touches, TouchList* targetTouches, |
86 TouchList* changedTouches, const AtomicString& type, | 92 TouchList* changedTouches, const AtomicString& type, |
87 PassRefPtrWillBeRawPtr<AbstractView>, PlatformEvent::Modifiers, | 93 PassRefPtrWillBeRawPtr<AbstractView>, PlatformEvent::Modifiers, |
88 bool cancelable, bool causesScrollingIfUncanceled, | 94 bool cancelable, bool causesScrollingIfUncanceled, |
89 double uiCreateTime = 0); | 95 double uiCreateTime = 0); |
| 96 TouchEvent(const AtomicString&, const TouchEventInit&); |
90 | 97 |
91 RefPtrWillBeMember<TouchList> m_touches; | 98 RefPtrWillBeMember<TouchList> m_touches; |
92 RefPtrWillBeMember<TouchList> m_targetTouches; | 99 RefPtrWillBeMember<TouchList> m_targetTouches; |
93 RefPtrWillBeMember<TouchList> m_changedTouches; | 100 RefPtrWillBeMember<TouchList> m_changedTouches; |
94 bool m_causesScrollingIfUncanceled; | 101 bool m_causesScrollingIfUncanceled; |
95 }; | 102 }; |
96 | 103 |
97 class TouchEventDispatchMediator final : public EventDispatchMediator { | 104 class TouchEventDispatchMediator final : public EventDispatchMediator { |
98 public: | 105 public: |
99 static PassRefPtrWillBeRawPtr<TouchEventDispatchMediator> create(PassRefPtrW
illBeRawPtr<TouchEvent>); | 106 static PassRefPtrWillBeRawPtr<TouchEventDispatchMediator> create(PassRefPtrW
illBeRawPtr<TouchEvent>); |
100 | 107 |
101 private: | 108 private: |
102 explicit TouchEventDispatchMediator(PassRefPtrWillBeRawPtr<TouchEvent>); | 109 explicit TouchEventDispatchMediator(PassRefPtrWillBeRawPtr<TouchEvent>); |
103 TouchEvent& event() const; | 110 TouchEvent& event() const; |
104 bool dispatchEvent(EventDispatcher&) const override; | 111 bool dispatchEvent(EventDispatcher&) const override; |
105 }; | 112 }; |
106 | 113 |
107 DEFINE_EVENT_TYPE_CASTS(TouchEvent); | 114 DEFINE_EVENT_TYPE_CASTS(TouchEvent); |
108 | 115 |
109 } // namespace blink | 116 } // namespace blink |
110 | 117 |
111 #endif // TouchEvent_h | 118 #endif // TouchEvent_h |
OLD | NEW |