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/TouchEventInit.h" | 33 #include "core/events/TouchEventInit.h" |
34 #include "core/events/UIEventWithKeyState.h" | 34 #include "core/events/UIEventWithKeyState.h" |
| 35 #include "public/platform/WebCoalescedInputEvent.h" |
35 #include "public/platform/WebTouchEvent.h" | 36 #include "public/platform/WebTouchEvent.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 class CORE_EXPORT TouchEvent final : public UIEventWithKeyState { | 40 class CORE_EXPORT TouchEvent final : public UIEventWithKeyState { |
40 DEFINE_WRAPPERTYPEINFO(); | 41 DEFINE_WRAPPERTYPEINFO(); |
41 | 42 |
42 public: | 43 public: |
43 ~TouchEvent() override; | 44 ~TouchEvent() override; |
44 | 45 |
45 // We only initialize sourceCapabilities when we create TouchEvent from | 46 // We only initialize sourceCapabilities when we create TouchEvent from |
46 // EventHandler, null if it is from JavaScript. | 47 // EventHandler, null if it is from JavaScript. |
47 static TouchEvent* Create() { return new TouchEvent; } | 48 static TouchEvent* Create() { return new TouchEvent; } |
48 static TouchEvent* Create(const WebTouchEvent& event, | 49 static TouchEvent* Create(const WebCoalescedInputEvent& event, |
49 TouchList* touches, | 50 TouchList* touches, |
50 TouchList* target_touches, | 51 TouchList* target_touches, |
51 TouchList* changed_touches, | 52 TouchList* changed_touches, |
52 const AtomicString& type, | 53 const AtomicString& type, |
53 AbstractView* view, | 54 AbstractView* view, |
54 TouchAction current_touch_action) { | 55 TouchAction current_touch_action) { |
55 return new TouchEvent(event, touches, target_touches, changed_touches, type, | 56 return new TouchEvent(event, touches, target_touches, changed_touches, type, |
56 view, current_touch_action); | 57 view, current_touch_action); |
57 } | 58 } |
58 | 59 |
(...skipping 17 matching lines...) Expand all Loading... |
76 bool IsTouchEvent() const override; | 77 bool IsTouchEvent() const override; |
77 | 78 |
78 const AtomicString& InterfaceName() const override; | 79 const AtomicString& InterfaceName() const override; |
79 | 80 |
80 void preventDefault() override; | 81 void preventDefault() override; |
81 | 82 |
82 void DoneDispatchingEventAtCurrentTarget() override; | 83 void DoneDispatchingEventAtCurrentTarget() override; |
83 | 84 |
84 EventDispatchMediator* CreateMediator() override; | 85 EventDispatchMediator* CreateMediator() override; |
85 | 86 |
86 const WebTouchEvent* NativeEvent() const { return native_event_.get(); } | 87 const WebCoalescedInputEvent* NativeEvent() const { |
| 88 return native_event_.get(); |
| 89 } |
87 | 90 |
88 DECLARE_VIRTUAL_TRACE(); | 91 DECLARE_VIRTUAL_TRACE(); |
89 | 92 |
90 private: | 93 private: |
91 TouchEvent(); | 94 TouchEvent(); |
92 TouchEvent(const WebTouchEvent&, | 95 TouchEvent(const WebCoalescedInputEvent&, |
93 TouchList* touches, | 96 TouchList* touches, |
94 TouchList* target_touches, | 97 TouchList* target_touches, |
95 TouchList* changed_touches, | 98 TouchList* changed_touches, |
96 const AtomicString& type, | 99 const AtomicString& type, |
97 AbstractView*, | 100 AbstractView*, |
98 TouchAction current_touch_action); | 101 TouchAction current_touch_action); |
99 TouchEvent(const AtomicString&, const TouchEventInit&); | 102 TouchEvent(const AtomicString&, const TouchEventInit&); |
100 bool IsTouchStartOrFirstTouchMove() const; | 103 bool IsTouchStartOrFirstTouchMove() const; |
101 | 104 |
102 Member<TouchList> touches_; | 105 Member<TouchList> touches_; |
103 Member<TouchList> target_touches_; | 106 Member<TouchList> target_touches_; |
104 Member<TouchList> changed_touches_; | 107 Member<TouchList> changed_touches_; |
105 | 108 |
106 bool default_prevented_before_current_target_; | 109 bool default_prevented_before_current_target_; |
107 | 110 |
108 // The current effective touch action computed before each | 111 // The current effective touch action computed before each |
109 // touchstart event is generated. It is used for UMA histograms. | 112 // touchstart event is generated. It is used for UMA histograms. |
110 TouchAction current_touch_action_; | 113 TouchAction current_touch_action_; |
111 | 114 |
112 std::unique_ptr<WebTouchEvent> native_event_; | 115 std::unique_ptr<WebCoalescedInputEvent> native_event_; |
113 }; | 116 }; |
114 | 117 |
115 class TouchEventDispatchMediator final : public EventDispatchMediator { | 118 class TouchEventDispatchMediator final : public EventDispatchMediator { |
116 public: | 119 public: |
117 static TouchEventDispatchMediator* Create(TouchEvent*); | 120 static TouchEventDispatchMediator* Create(TouchEvent*); |
118 | 121 |
119 private: | 122 private: |
120 explicit TouchEventDispatchMediator(TouchEvent*); | 123 explicit TouchEventDispatchMediator(TouchEvent*); |
121 TouchEvent& Event() const; | 124 TouchEvent& Event() const; |
122 DispatchEventResult DispatchEvent(EventDispatcher&) const override; | 125 DispatchEventResult DispatchEvent(EventDispatcher&) const override; |
123 }; | 126 }; |
124 | 127 |
125 DEFINE_EVENT_TYPE_CASTS(TouchEvent); | 128 DEFINE_EVENT_TYPE_CASTS(TouchEvent); |
126 | 129 |
127 } // namespace blink | 130 } // namespace blink |
128 | 131 |
129 #endif // TouchEvent_h | 132 #endif // TouchEvent_h |
OLD | NEW |