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