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 15 matching lines...) Expand all Loading... |
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/MouseRelatedEvent.h" |
32 #include "platform/PlatformGestureEvent.h" | 32 #include "platform/PlatformGestureEvent.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
| 36 enum GestureSource { |
| 37 GestureSourceUninitialized, |
| 38 GestureSourceTouchpad, |
| 39 GestureSourceTouchscreen |
| 40 }; |
| 41 |
36 class CORE_EXPORT GestureEvent final : public MouseRelatedEvent { | 42 class CORE_EXPORT GestureEvent final : public MouseRelatedEvent { |
37 public: | 43 public: |
38 ~GestureEvent() override { } | 44 ~GestureEvent() override { } |
39 | 45 |
40 static PassRefPtrWillBeRawPtr<GestureEvent> create(PassRefPtrWillBeRawPtr<Ab
stractView>, const PlatformGestureEvent&); | 46 static PassRefPtrWillBeRawPtr<GestureEvent> create(PassRefPtrWillBeRawPtr<Ab
stractView>, const PlatformGestureEvent&); |
41 | 47 |
42 bool isGestureEvent() const override; | 48 bool isGestureEvent() const override; |
43 | 49 |
44 const AtomicString& interfaceName() const override; | 50 const AtomicString& interfaceName() const override; |
45 | 51 |
46 float deltaX() const { return m_deltaX; } | 52 float deltaX() const { return m_deltaX; } |
47 float deltaY() const { return m_deltaY; } | 53 float deltaY() const { return m_deltaY; } |
48 float velocityX() const { return m_velocityX; } | 54 float velocityX() const { return m_velocityX; } |
49 float velocityY() const { return m_velocityY; } | 55 float velocityY() const { return m_velocityY; } |
50 bool inertial() const { return m_inertial; } | 56 bool inertial() const { return m_inertial; } |
51 | 57 |
| 58 GestureSource source() const { return m_source; } |
52 int resendingPluginId() const { return m_resendingPluginId; } | 59 int resendingPluginId() const { return m_resendingPluginId; } |
53 | 60 |
54 PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator() override; | 61 PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator() override; |
55 | 62 |
56 DECLARE_VIRTUAL_TRACE(); | 63 DECLARE_VIRTUAL_TRACE(); |
57 | 64 |
58 private: | 65 private: |
59 GestureEvent(); | 66 GestureEvent(); |
60 GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView>,
int screenX, int screenY, int clientX, int clientY, PlatformEvent::Modifiers, f
loat deltaX, float deltaY, float velocityX, float velocityY, bool inertial, doub
le uiTimeStamp, int resendingPluginId); | 67 GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView>,
int screenX, int screenY, int clientX, int clientY, PlatformEvent::Modifiers, f
loat deltaX, float deltaY, float velocityX, float velocityY, bool inertial, doub
le uiTimeStamp, int resendingPluginId, GestureSource); |
61 | 68 |
62 float m_deltaX; | 69 float m_deltaX; |
63 float m_deltaY; | 70 float m_deltaY; |
64 float m_velocityX; | 71 float m_velocityX; |
65 float m_velocityY; | 72 float m_velocityY; |
66 bool m_inertial; | 73 bool m_inertial; |
67 | 74 |
| 75 GestureSource m_source; |
68 int m_resendingPluginId; | 76 int m_resendingPluginId; |
69 }; | 77 }; |
70 | 78 |
71 class GestureEventDispatchMediator final : public EventDispatchMediator { | 79 class GestureEventDispatchMediator final : public EventDispatchMediator { |
72 public: | 80 public: |
73 static PassRefPtrWillBeRawPtr<GestureEventDispatchMediator> create(PassRefPt
rWillBeRawPtr<GestureEvent> gestureEvent) | 81 static PassRefPtrWillBeRawPtr<GestureEventDispatchMediator> create(PassRefPt
rWillBeRawPtr<GestureEvent> gestureEvent) |
74 { | 82 { |
75 return adoptRefWillBeNoop(new GestureEventDispatchMediator(gestureEvent)
); | 83 return adoptRefWillBeNoop(new GestureEventDispatchMediator(gestureEvent)
); |
76 } | 84 } |
77 | 85 |
78 private: | 86 private: |
79 explicit GestureEventDispatchMediator(PassRefPtrWillBeRawPtr<GestureEvent>); | 87 explicit GestureEventDispatchMediator(PassRefPtrWillBeRawPtr<GestureEvent>); |
80 | 88 |
81 GestureEvent& event() const; | 89 GestureEvent& event() const; |
82 | 90 |
83 bool dispatchEvent(EventDispatcher&) const override; | 91 bool dispatchEvent(EventDispatcher&) const override; |
84 }; | 92 }; |
85 | 93 |
86 DEFINE_EVENT_TYPE_CASTS(GestureEvent); | 94 DEFINE_EVENT_TYPE_CASTS(GestureEvent); |
87 | 95 |
88 } // namespace blink | 96 } // namespace blink |
89 | 97 |
90 #endif // GestureEvent_h | 98 #endif // GestureEvent_h |
OLD | NEW |