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 14 matching lines...) Expand all Loading... |
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/dom/TouchList.h" |
32 #include "core/events/EventDispatchMediator.h" | 32 #include "core/events/EventDispatchMediator.h" |
33 #include "core/events/MouseRelatedEvent.h" | 33 #include "core/events/MouseRelatedEvent.h" |
34 #include "core/events/TouchEventInit.h" | 34 #include "core/events/TouchEventInit.h" |
| 35 #include "public/platform/WebPointerProperties.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 class CORE_EXPORT TouchEvent final : public UIEventWithKeyState { | 39 class CORE_EXPORT TouchEvent final : public UIEventWithKeyState { |
39 DEFINE_WRAPPERTYPEINFO(); | 40 DEFINE_WRAPPERTYPEINFO(); |
40 | 41 |
41 public: | 42 public: |
42 ~TouchEvent() override; | 43 ~TouchEvent() override; |
43 | 44 |
44 // We only initialize sourceCapabilities when we create TouchEvent from | 45 // We only initialize sourceCapabilities when we create TouchEvent from |
45 // EventHandler, null if it is from JavaScript. | 46 // EventHandler, null if it is from JavaScript. |
46 static TouchEvent* create() { return new TouchEvent; } | 47 static TouchEvent* create() { return new TouchEvent; } |
47 static TouchEvent* create(TouchList* touches, | 48 static TouchEvent* create(TouchList* touches, |
48 TouchList* targetTouches, | 49 TouchList* targetTouches, |
49 TouchList* changedTouches, | 50 TouchList* changedTouches, |
50 const AtomicString& type, | 51 const AtomicString& type, |
51 AbstractView* view, | 52 AbstractView* view, |
52 PlatformEvent::Modifiers modifiers, | 53 PlatformEvent::Modifiers modifiers, |
53 bool cancelable, | 54 bool cancelable, |
54 bool causesScrollingIfUncanceled, | 55 bool causesScrollingIfUncanceled, |
55 bool firstTouchMoveOrStart, | 56 bool firstTouchMoveOrStart, |
56 double platformTimeStamp, | 57 double platformTimeStamp, |
57 TouchAction currentTouchAction) { | 58 TouchAction currentTouchAction, |
| 59 WebPointerProperties::PointerType pointerType) { |
58 return new TouchEvent(touches, targetTouches, changedTouches, type, view, | 60 return new TouchEvent(touches, targetTouches, changedTouches, type, view, |
59 modifiers, cancelable, causesScrollingIfUncanceled, | 61 modifiers, cancelable, causesScrollingIfUncanceled, |
60 firstTouchMoveOrStart, platformTimeStamp, | 62 firstTouchMoveOrStart, platformTimeStamp, |
61 currentTouchAction); | 63 currentTouchAction, pointerType); |
62 } | 64 } |
63 | 65 |
64 static TouchEvent* create(const AtomicString& type, | 66 static TouchEvent* create(const AtomicString& type, |
65 const TouchEventInit& initializer) { | 67 const TouchEventInit& initializer) { |
66 return new TouchEvent(type, initializer); | 68 return new TouchEvent(type, initializer); |
67 } | 69 } |
68 | 70 |
69 TouchList* touches() const { return m_touches.get(); } | 71 TouchList* touches() const { return m_touches.get(); } |
70 TouchList* targetTouches() const { return m_targetTouches.get(); } | 72 TouchList* targetTouches() const { return m_targetTouches.get(); } |
71 TouchList* changedTouches() const { return m_changedTouches.get(); } | 73 TouchList* changedTouches() const { return m_changedTouches.get(); } |
(...skipping 13 matching lines...) Expand all Loading... |
85 bool isTouchEvent() const override; | 87 bool isTouchEvent() const override; |
86 | 88 |
87 const AtomicString& interfaceName() const override; | 89 const AtomicString& interfaceName() const override; |
88 | 90 |
89 void preventDefault() override; | 91 void preventDefault() override; |
90 | 92 |
91 void doneDispatchingEventAtCurrentTarget() override; | 93 void doneDispatchingEventAtCurrentTarget() override; |
92 | 94 |
93 EventDispatchMediator* createMediator() override; | 95 EventDispatchMediator* createMediator() override; |
94 | 96 |
| 97 // Transient property to inform PPAPI of touch pointer types. Will be replaced |
| 98 // when blink transitions to handling end-to-end pointer events. |
| 99 WebPointerProperties::PointerType pointerType() const { |
| 100 return m_pointerType; |
| 101 } |
| 102 |
95 DECLARE_VIRTUAL_TRACE(); | 103 DECLARE_VIRTUAL_TRACE(); |
96 | 104 |
97 private: | 105 private: |
98 TouchEvent(); | 106 TouchEvent(); |
99 TouchEvent(TouchList* touches, | 107 TouchEvent(TouchList* touches, |
100 TouchList* targetTouches, | 108 TouchList* targetTouches, |
101 TouchList* changedTouches, | 109 TouchList* changedTouches, |
102 const AtomicString& type, | 110 const AtomicString& type, |
103 AbstractView*, | 111 AbstractView*, |
104 PlatformEvent::Modifiers, | 112 PlatformEvent::Modifiers, |
105 bool cancelable, | 113 bool cancelable, |
106 bool causesScrollingIfUncanceled, | 114 bool causesScrollingIfUncanceled, |
107 bool firstTouchMoveOrStart, | 115 bool firstTouchMoveOrStart, |
108 double platformTimeStamp, | 116 double platformTimeStamp, |
109 TouchAction currentTouchAction); | 117 TouchAction currentTouchAction, |
| 118 WebPointerProperties::PointerType); |
110 TouchEvent(const AtomicString&, const TouchEventInit&); | 119 TouchEvent(const AtomicString&, const TouchEventInit&); |
111 | 120 |
112 Member<TouchList> m_touches; | 121 Member<TouchList> m_touches; |
113 Member<TouchList> m_targetTouches; | 122 Member<TouchList> m_targetTouches; |
114 Member<TouchList> m_changedTouches; | 123 Member<TouchList> m_changedTouches; |
115 bool m_causesScrollingIfUncanceled; | 124 bool m_causesScrollingIfUncanceled; |
116 bool m_firstTouchMoveOrStart; | 125 bool m_firstTouchMoveOrStart; |
117 bool m_defaultPreventedBeforeCurrentTarget; | 126 bool m_defaultPreventedBeforeCurrentTarget; |
118 | 127 |
119 // The current effective touch action computed before each | 128 // The current effective touch action computed before each |
120 // touchstart event is generated. It is used for UMA histograms. | 129 // touchstart event is generated. It is used for UMA histograms. |
121 TouchAction m_currentTouchAction; | 130 TouchAction m_currentTouchAction; |
| 131 |
| 132 WebPointerProperties::PointerType m_pointerType; |
122 }; | 133 }; |
123 | 134 |
124 class TouchEventDispatchMediator final : public EventDispatchMediator { | 135 class TouchEventDispatchMediator final : public EventDispatchMediator { |
125 public: | 136 public: |
126 static TouchEventDispatchMediator* create(TouchEvent*); | 137 static TouchEventDispatchMediator* create(TouchEvent*); |
127 | 138 |
128 private: | 139 private: |
129 explicit TouchEventDispatchMediator(TouchEvent*); | 140 explicit TouchEventDispatchMediator(TouchEvent*); |
130 TouchEvent& event() const; | 141 TouchEvent& event() const; |
131 DispatchEventResult dispatchEvent(EventDispatcher&) const override; | 142 DispatchEventResult dispatchEvent(EventDispatcher&) const override; |
132 }; | 143 }; |
133 | 144 |
134 DEFINE_EVENT_TYPE_CASTS(TouchEvent); | 145 DEFINE_EVENT_TYPE_CASTS(TouchEvent); |
135 | 146 |
136 } // namespace blink | 147 } // namespace blink |
137 | 148 |
138 #endif // TouchEvent_h | 149 #endif // TouchEvent_h |
OLD | NEW |