| 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 #include "core/events/InputEvent.h" | 5 #include "core/events/InputEvent.h" |
| 6 | 6 |
| 7 #include "core/dom/Range.h" | 7 #include "core/dom/Range.h" |
| 8 #include "core/events/EventDispatcher.h" | 8 #include "core/events/EventDispatcher.h" |
| 9 #include "public/platform/WebEditingCommandType.h" | 9 #include "public/platform/WebEditingCommandType.h" |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // TODO(chongz): Use binary search if the map goes larger. | 78 // TODO(chongz): Use binary search if the map goes larger. |
| 79 for (const auto& entry : kInputTypeStringNameMap) { | 79 for (const auto& entry : kInputTypeStringNameMap) { |
| 80 if (stringName == entry.stringName) | 80 if (stringName == entry.stringName) |
| 81 return entry.inputType; | 81 return entry.inputType; |
| 82 } | 82 } |
| 83 return InputEvent::InputType::None; | 83 return InputEvent::InputType::None; |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // anonymous namespace | 86 } // anonymous namespace |
| 87 | 87 |
| 88 InputEvent::InputEvent() | |
| 89 { | |
| 90 } | |
| 91 | |
| 92 InputEvent::InputEvent(const AtomicString& type, const InputEventInit& initializ
er) | 88 InputEvent::InputEvent(const AtomicString& type, const InputEventInit& initializ
er) |
| 93 : UIEvent(type, initializer) | 89 : UIEvent(type, initializer) |
| 94 { | 90 { |
| 95 // TODO(ojan): We should find a way to prevent conversion like String->enum-
>String just in order to use initializer. | 91 // TODO(ojan): We should find a way to prevent conversion like String->enum-
>String just in order to use initializer. |
| 96 // See InputEvent::createBeforeInput() for the first conversion. | 92 // See InputEvent::createBeforeInput() for the first conversion. |
| 97 if (initializer.hasInputType()) | 93 if (initializer.hasInputType()) |
| 98 m_inputType = convertStringToInputType(initializer.inputType()); | 94 m_inputType = convertStringToInputType(initializer.inputType()); |
| 99 if (initializer.hasData()) | 95 if (initializer.hasData()) |
| 100 m_data = initializer.data(); | 96 m_data = initializer.data(); |
| 101 if (initializer.hasIsComposing()) | 97 if (initializer.hasIsComposing()) |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // 3. We don't want authors to hold live |Range| indefinitely by holding |
InputEvent|, so we | 194 // 3. We don't want authors to hold live |Range| indefinitely by holding |
InputEvent|, so we |
| 199 // clear them after dispatch. | 195 // clear them after dispatch. |
| 200 // Authors should explicitly call |getRanges()|->|toRange()| if they want to
keep a copy of |Range|. | 196 // Authors should explicitly call |getRanges()|->|toRange()| if they want to
keep a copy of |Range|. |
| 201 // See Editing TF meeting notes: | 197 // See Editing TF meeting notes: |
| 202 // https://docs.google.com/document/d/1hCj6QX77NYIVY0RWrMHT1Yra6t8_Qu8PopaWL
G0AM58/edit?usp=sharing | 198 // https://docs.google.com/document/d/1hCj6QX77NYIVY0RWrMHT1Yra6t8_Qu8PopaWL
G0AM58/edit?usp=sharing |
| 203 event().m_ranges.clear(); | 199 event().m_ranges.clear(); |
| 204 return result; | 200 return result; |
| 205 } | 201 } |
| 206 | 202 |
| 207 } // namespace blink | 203 } // namespace blink |
| OLD | NEW |