| 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/events/InputEventInit.h" | 8 #include "core/events/InputEventInit.h" |
| 9 #include "core/events/UIEvent.h" | 9 #include "core/events/UIEvent.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class Range; |
| 14 |
| 13 class InputEvent final : public UIEvent { | 15 class InputEvent final : public UIEvent { |
| 14 DEFINE_WRAPPERTYPEINFO(); | 16 DEFINE_WRAPPERTYPEINFO(); |
| 15 | 17 |
| 16 public: | 18 public: |
| 17 static InputEvent* create() | 19 static InputEvent* create() |
| 18 { | 20 { |
| 19 return new InputEvent; | 21 return new InputEvent; |
| 20 } | 22 } |
| 21 | 23 |
| 22 static InputEvent* create(const AtomicString& type, const InputEventInit& in
itializer) | 24 static InputEvent* create(const AtomicString& type, const InputEventInit& in
itializer) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 40 enum EventCancelable : bool { | 42 enum EventCancelable : bool { |
| 41 NotCancelable = false, | 43 NotCancelable = false, |
| 42 IsCancelable = true, | 44 IsCancelable = true, |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 enum EventIsComposing : bool { | 47 enum EventIsComposing : bool { |
| 46 NotComposing = false, | 48 NotComposing = false, |
| 47 IsComposing = true, | 49 IsComposing = true, |
| 48 }; | 50 }; |
| 49 | 51 |
| 50 static InputEvent* createBeforeInput(InputType, const String& data, EventCan
celable, EventIsComposing); | 52 static InputEvent* createBeforeInput(InputType, const String& data, EventCan
celable, EventIsComposing, const HeapVector<Member<Range>>&); |
| 51 | 53 |
| 52 String inputType() const; | 54 String inputType() const; |
| 53 const String& data() const { return m_data; } | 55 const String& data() const { return m_data; } |
| 54 bool isComposing() const { return m_isComposing; } | 56 bool isComposing() const { return m_isComposing; } |
| 57 // TODO(chongz): Return StaticRange. |
| 58 HeapVector<Member<Range>> getRanges() const { return m_ranges; }; |
| 55 | 59 |
| 56 bool isInputEvent() const override; | 60 bool isInputEvent() const override; |
| 57 | 61 |
| 62 EventDispatchMediator* createMediator() override; |
| 63 |
| 58 DECLARE_VIRTUAL_TRACE(); | 64 DECLARE_VIRTUAL_TRACE(); |
| 59 | 65 |
| 60 private: | 66 private: |
| 67 friend class InputEventDispatchMediator; |
| 61 InputEvent(); | 68 InputEvent(); |
| 62 InputEvent(const AtomicString&, const InputEventInit&); | 69 InputEvent(const AtomicString&, const InputEventInit&); |
| 63 | 70 |
| 64 InputType m_inputType; | 71 InputType m_inputType; |
| 65 String m_data; | 72 String m_data; |
| 66 bool m_isComposing; | 73 bool m_isComposing; |
| 74 HeapVector<Member<Range>> m_ranges; |
| 75 }; |
| 76 |
| 77 class InputEventDispatchMediator final : public EventDispatchMediator { |
| 78 public: |
| 79 static InputEventDispatchMediator* create(InputEvent*); |
| 80 |
| 81 private: |
| 82 explicit InputEventDispatchMediator(InputEvent*); |
| 83 InputEvent& event() const; |
| 84 DispatchEventResult dispatchEvent(EventDispatcher&) const override; |
| 67 }; | 85 }; |
| 68 | 86 |
| 69 DEFINE_EVENT_TYPE_CASTS(InputEvent); | 87 DEFINE_EVENT_TYPE_CASTS(InputEvent); |
| 70 | 88 |
| 71 } // namespace blink | 89 } // namespace blink |
| 72 | 90 |
| 73 #endif // InputEvent_h | 91 #endif // InputEvent_h |
| OLD | NEW |