OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
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 10 matching lines...) Expand all Loading... | |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef GestureEvent_h | 26 #ifndef GestureEvent_h |
27 #define GestureEvent_h | 27 #define GestureEvent_h |
28 | 28 |
29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
30 #include "core/events/EventDispatcher.h" | 30 #include "core/events/EventDispatcher.h" |
31 #include "core/events/MouseRelatedEvent.h" | 31 #include "core/events/UIEventWithKeyState.h" |
32 #include "platform/PlatformGestureEvent.h" | 32 #include "public/platform/WebGestureEvent.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 enum GestureSource { | 36 class CORE_EXPORT GestureEvent final : public UIEventWithKeyState { |
37 GestureSourceUninitialized, | |
38 GestureSourceTouchpad, | |
39 GestureSourceTouchscreen | |
40 }; | |
41 | |
42 class CORE_EXPORT GestureEvent final : public MouseRelatedEvent { | |
43 public: | 37 public: |
38 static GestureEvent* create(AbstractView*, const WebGestureEvent&); | |
44 ~GestureEvent() override {} | 39 ~GestureEvent() override {} |
45 | 40 |
46 static GestureEvent* create(AbstractView*, const PlatformGestureEvent&); | |
47 | |
48 bool isGestureEvent() const override; | 41 bool isGestureEvent() const override; |
49 | 42 |
50 const AtomicString& interfaceName() const override; | 43 const AtomicString& interfaceName() const override; |
51 | 44 |
52 float deltaX() const { return m_deltaX; } | 45 const WebGestureEvent& originalEvent() const { return m_nativeEvent; } |
majidvp
2016/12/15 17:40:45
nit: better to have the accessor and field names m
mustaq
2016/12/15 19:25:46
+1, "original" could be confusing.
dtapuska
2016/12/15 21:29:38
Done.
| |
53 float deltaY() const { return m_deltaY; } | |
54 float velocityX() const { return m_velocityX; } | |
55 float velocityY() const { return m_velocityY; } | |
56 ScrollInertialPhase inertialPhase() const { return m_inertialPhase; } | |
57 | |
58 GestureSource source() const { return m_source; } | |
59 int resendingPluginId() const { return m_resendingPluginId; } | |
60 bool synthetic() const { return m_synthetic; } | |
61 ScrollGranularity deltaUnits() const { return m_deltaUnits; } | |
62 | 46 |
63 DECLARE_VIRTUAL_TRACE(); | 47 DECLARE_VIRTUAL_TRACE(); |
64 | 48 |
65 private: | 49 private: |
66 GestureEvent(const AtomicString& type, | 50 GestureEvent(const AtomicString&, AbstractView*, const WebGestureEvent&); |
67 AbstractView*, | |
68 int screenX, | |
69 int screenY, | |
70 int clientX, | |
71 int clientY, | |
72 PlatformEvent::Modifiers, | |
73 float deltaX, | |
74 float deltaY, | |
75 float velocityX, | |
76 float velocityY, | |
77 ScrollInertialPhase, | |
78 bool synthetic, | |
79 ScrollGranularity deltaUnits, | |
80 TimeTicks platformTimeStamp, | |
81 int resendingPluginId, | |
82 GestureSource); | |
83 | 51 |
84 float m_deltaX; | 52 WebGestureEvent m_nativeEvent; |
85 float m_deltaY; | |
86 float m_velocityX; | |
87 float m_velocityY; | |
88 ScrollInertialPhase m_inertialPhase; | |
89 bool m_synthetic; | |
90 ScrollGranularity m_deltaUnits; | |
91 GestureSource m_source; | |
92 int m_resendingPluginId; | |
93 }; | 53 }; |
94 | 54 |
95 DEFINE_EVENT_TYPE_CASTS(GestureEvent); | 55 DEFINE_EVENT_TYPE_CASTS(GestureEvent); |
96 | 56 |
97 } // namespace blink | 57 } // namespace blink |
98 | 58 |
99 #endif // GestureEvent_h | 59 #endif // GestureEvent_h |
OLD | NEW |