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 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 const struct { | 15 const struct { |
16 InputEvent::InputType inputType; | 16 InputEvent::InputType inputType; |
17 const char* stringName; | 17 const char* stringName; |
18 } kInputTypeStringNameMap[] = { | 18 } kInputTypeStringNameMap[] = { |
19 {InputEvent::InputType::None, ""}, | 19 {InputEvent::InputType::None, ""}, |
20 {InputEvent::InputType::InsertText, "insertText"}, | 20 {InputEvent::InputType::InsertText, "insertText"}, |
21 {InputEvent::InputType::InsertLineBreak, "insertLineBreak"}, | 21 {InputEvent::InputType::InsertLineBreak, "insertLineBreak"}, |
22 {InputEvent::InputType::InsertParagraph, "insertParagraph"}, | 22 {InputEvent::InputType::InsertParagraph, "insertParagraph"}, |
23 {InputEvent::InputType::InsertOrderedList, "insertOrderedList"}, | 23 {InputEvent::InputType::InsertOrderedList, "insertOrderedList"}, |
24 {InputEvent::InputType::InsertUnorderedList, "insertUnorderedList"}, | 24 {InputEvent::InputType::InsertUnorderedList, "insertUnorderedList"}, |
25 {InputEvent::InputType::InsertHorizontalRule, "insertHorizontalRule"}, | 25 {InputEvent::InputType::InsertHorizontalRule, "insertHorizontalRule"}, |
26 {InputEvent::InputType::InsertFromPaste, "insertFromPaste"}, | 26 {InputEvent::InputType::InsertFromPaste, "insertFromPaste"}, |
27 {InputEvent::InputType::InsertFromDrop, "insertFromDrop"}, | 27 {InputEvent::InputType::InsertFromDrop, "insertFromDrop"}, |
28 {InputEvent::InputType::InsertReplacementText, "insertReplacementText"}, | 28 {InputEvent::InputType::InsertReplacementText, "insertReplacementText"}, |
29 {InputEvent::InputType::DeleteComposedCharacterForward, | 29 {InputEvent::InputType::InsertCompositionText, "insertCompositionText"}, |
30 "deleteComposedCharacterForward"}, | |
31 {InputEvent::InputType::DeleteComposedCharacterBackward, | |
32 "deleteComposedCharacterBackward"}, | |
33 {InputEvent::InputType::DeleteWordBackward, "deleteWordBackward"}, | 30 {InputEvent::InputType::DeleteWordBackward, "deleteWordBackward"}, |
34 {InputEvent::InputType::DeleteWordForward, "deleteWordForward"}, | 31 {InputEvent::InputType::DeleteWordForward, "deleteWordForward"}, |
35 {InputEvent::InputType::DeleteLineBackward, "deleteLineBackward"}, | 32 {InputEvent::InputType::DeleteLineBackward, "deleteLineBackward"}, |
36 {InputEvent::InputType::DeleteLineForward, "deleteLineForward"}, | 33 {InputEvent::InputType::DeleteLineForward, "deleteLineForward"}, |
37 {InputEvent::InputType::DeleteContentBackward, "deleteContentBackward"}, | 34 {InputEvent::InputType::DeleteContentBackward, "deleteContentBackward"}, |
38 {InputEvent::InputType::DeleteContentForward, "deleteContentForward"}, | 35 {InputEvent::InputType::DeleteContentForward, "deleteContentForward"}, |
39 {InputEvent::InputType::DeleteByCut, "deleteByCut"}, | 36 {InputEvent::InputType::DeleteByCut, "deleteByCut"}, |
40 {InputEvent::InputType::DeleteByDrag, "deleteByDrag"}, | 37 {InputEvent::InputType::DeleteByDrag, "deleteByDrag"}, |
41 {InputEvent::InputType::HistoryUndo, "historyUndo"}, | 38 {InputEvent::InputType::HistoryUndo, "historyUndo"}, |
42 {InputEvent::InputType::HistoryRedo, "historyRedo"}, | 39 {InputEvent::InputType::HistoryRedo, "historyRedo"}, |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // 3. We don't want authors to hold live |Range| indefinitely by holding | 214 // 3. We don't want authors to hold live |Range| indefinitely by holding |
218 // |InputEvent|, so we clear them after dispatch. | 215 // |InputEvent|, so we clear them after dispatch. |
219 // Authors should explicitly call |getTargetRanges()|->|toRange()| if they | 216 // Authors should explicitly call |getTargetRanges()|->|toRange()| if they |
220 // want to keep a copy of |Range|. See Editing TF meeting notes: | 217 // want to keep a copy of |Range|. See Editing TF meeting notes: |
221 // https://docs.google.com/document/d/1hCj6QX77NYIVY0RWrMHT1Yra6t8_Qu8PopaWLG0
AM58/edit?usp=sharing | 218 // https://docs.google.com/document/d/1hCj6QX77NYIVY0RWrMHT1Yra6t8_Qu8PopaWLG0
AM58/edit?usp=sharing |
222 event().m_ranges.clear(); | 219 event().m_ranges.clear(); |
223 return result; | 220 return result; |
224 } | 221 } |
225 | 222 |
226 } // namespace blink | 223 } // namespace blink |
OLD | NEW |