OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef InputEvent_h | 5 #ifndef InputEvent_h |
6 #define InputEvent_h | 6 #define InputEvent_h |
7 | 7 |
8 #include "core/dom/StaticRange.h" | 8 #include "core/dom/StaticRange.h" |
9 #include "core/events/InputEventInit.h" | 9 #include "core/events/InputEventInit.h" |
10 #include "core/events/UIEvent.h" | 10 #include "core/events/UIEvent.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class InputEvent final : public UIEvent { | 14 class InputEvent final : public UIEvent { |
15 DEFINE_WRAPPERTYPEINFO(); | 15 DEFINE_WRAPPERTYPEINFO(); |
16 | 16 |
17 public: | 17 public: |
18 static InputEvent* create() | |
19 { | |
20 return new InputEvent; | |
21 } | |
22 | |
23 static InputEvent* create(const AtomicString& type, const InputEventInit& in
itializer) | 18 static InputEvent* create(const AtomicString& type, const InputEventInit& in
itializer) |
24 { | 19 { |
25 return new InputEvent(type, initializer); | 20 return new InputEvent(type, initializer); |
26 } | 21 } |
27 | 22 |
28 enum class InputType { | 23 enum class InputType { |
29 None, | 24 None, |
30 // Insertion. | 25 // Insertion. |
31 InsertText, | 26 InsertText, |
32 InsertNonText, | 27 InsertNonText, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 StaticRangeVector getRanges() const; | 98 StaticRangeVector getRanges() const; |
104 | 99 |
105 bool isInputEvent() const override; | 100 bool isInputEvent() const override; |
106 | 101 |
107 EventDispatchMediator* createMediator() override; | 102 EventDispatchMediator* createMediator() override; |
108 | 103 |
109 DECLARE_VIRTUAL_TRACE(); | 104 DECLARE_VIRTUAL_TRACE(); |
110 | 105 |
111 private: | 106 private: |
112 friend class InputEventDispatchMediator; | 107 friend class InputEventDispatchMediator; |
113 InputEvent(); | |
114 InputEvent(const AtomicString&, const InputEventInit&); | 108 InputEvent(const AtomicString&, const InputEventInit&); |
115 | 109 |
116 InputType m_inputType; | 110 InputType m_inputType; |
117 String m_data; | 111 String m_data; |
118 bool m_isComposing; | 112 bool m_isComposing; |
119 // We have to stored |Range| internally and only expose |StaticRange|, pleas
e | 113 // We have to stored |Range| internally and only expose |StaticRange|, pleas
e |
120 // see comments in |InputEventDispatchMediator::dispatchEvent()|. | 114 // see comments in |InputEventDispatchMediator::dispatchEvent()|. |
121 RangeVector m_ranges; | 115 RangeVector m_ranges; |
122 }; | 116 }; |
123 | 117 |
124 class InputEventDispatchMediator final : public EventDispatchMediator { | 118 class InputEventDispatchMediator final : public EventDispatchMediator { |
125 public: | 119 public: |
126 static InputEventDispatchMediator* create(InputEvent*); | 120 static InputEventDispatchMediator* create(InputEvent*); |
127 | 121 |
128 private: | 122 private: |
129 explicit InputEventDispatchMediator(InputEvent*); | 123 explicit InputEventDispatchMediator(InputEvent*); |
130 InputEvent& event() const; | 124 InputEvent& event() const; |
131 DispatchEventResult dispatchEvent(EventDispatcher&) const override; | 125 DispatchEventResult dispatchEvent(EventDispatcher&) const override; |
132 }; | 126 }; |
133 | 127 |
134 DEFINE_EVENT_TYPE_CASTS(InputEvent); | 128 DEFINE_EVENT_TYPE_CASTS(InputEvent); |
135 | 129 |
136 } // namespace blink | 130 } // namespace blink |
137 | 131 |
138 #endif // InputEvent_h | 132 #endif // InputEvent_h |
OLD | NEW |