Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(782)

Side by Side Diff: third_party/WebKit/Source/core/events/InputEvent.cpp

Issue 2374743002: [InputEvent] Support |deleteByDrag|, |insertFromDrop| and fire in sequential order (Closed)
Patch Set: Yosin's review Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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::InsertNonText, "insertNonText" }, 21 { InputEvent::InputType::InsertNonText, "insertNonText" },
22 { InputEvent::InputType::InsertLineBreak, "insertLineBreak" }, 22 { InputEvent::InputType::InsertLineBreak, "insertLineBreak" },
23 { InputEvent::InputType::InsertParagraph, "insertParagraph" }, 23 { InputEvent::InputType::InsertParagraph, "insertParagraph" },
24 { InputEvent::InputType::InsertOrderedList, "insertOrderedList" }, 24 { InputEvent::InputType::InsertOrderedList, "insertOrderedList" },
25 { InputEvent::InputType::InsertUnorderedList, "insertUnorderedList" }, 25 { InputEvent::InputType::InsertUnorderedList, "insertUnorderedList" },
26 { InputEvent::InputType::InsertHorizontalRule, "insertHorizontalRule" }, 26 { InputEvent::InputType::InsertHorizontalRule, "insertHorizontalRule" },
27 { InputEvent::InputType::InsertFromPaste, "insertFromPaste" }, 27 { InputEvent::InputType::InsertFromPaste, "insertFromPaste" },
28 { InputEvent::InputType::InsertFromDrop, "insertFromDrop" },
28 { InputEvent::InputType::DeleteComposedCharacterForward, "deleteComposedChar acterForward" }, 29 { InputEvent::InputType::DeleteComposedCharacterForward, "deleteComposedChar acterForward" },
29 { InputEvent::InputType::DeleteComposedCharacterBackward, "deleteComposedCha racterBackward" }, 30 { InputEvent::InputType::DeleteComposedCharacterBackward, "deleteComposedCha racterBackward" },
30 { InputEvent::InputType::DeleteWordBackward, "deleteWordBackward" }, 31 { InputEvent::InputType::DeleteWordBackward, "deleteWordBackward" },
31 { InputEvent::InputType::DeleteWordForward, "deleteWordForward" }, 32 { InputEvent::InputType::DeleteWordForward, "deleteWordForward" },
32 { InputEvent::InputType::DeleteLineBackward, "deleteLineBackward" }, 33 { InputEvent::InputType::DeleteLineBackward, "deleteLineBackward" },
33 { InputEvent::InputType::DeleteLineForward, "deleteLineForward" }, 34 { InputEvent::InputType::DeleteLineForward, "deleteLineForward" },
34 { InputEvent::InputType::DeleteContentBackward, "deleteContentBackward" }, 35 { InputEvent::InputType::DeleteContentBackward, "deleteContentBackward" },
35 { InputEvent::InputType::DeleteContentForward, "deleteContentForward" }, 36 { InputEvent::InputType::DeleteContentForward, "deleteContentForward" },
36 { InputEvent::InputType::DeleteByCut, "deleteByCut" }, 37 { InputEvent::InputType::DeleteByCut, "deleteByCut" },
38 { InputEvent::InputType::DeleteByDrag, "deleteByDrag" },
37 { InputEvent::InputType::Undo, "undo" }, 39 { InputEvent::InputType::Undo, "undo" },
38 { InputEvent::InputType::Redo, "redo" }, 40 { InputEvent::InputType::Redo, "redo" },
39 { InputEvent::InputType::Bold, "bold" }, 41 { InputEvent::InputType::Bold, "bold" },
40 { InputEvent::InputType::Italic, "italic" }, 42 { InputEvent::InputType::Italic, "italic" },
41 { InputEvent::InputType::Underline, "underline" }, 43 { InputEvent::InputType::Underline, "underline" },
42 { InputEvent::InputType::StrikeThrough, "strikeThrough" }, 44 { InputEvent::InputType::StrikeThrough, "strikeThrough" },
43 { InputEvent::InputType::Superscript, "superscript" }, 45 { InputEvent::InputType::Superscript, "superscript" },
44 { InputEvent::InputType::Subscript, "subscript" }, 46 { InputEvent::InputType::Subscript, "subscript" },
45 { InputEvent::InputType::JustifyCenter, "justifyCenter" }, 47 { InputEvent::InputType::JustifyCenter, "justifyCenter" },
46 { InputEvent::InputType::JustifyRight, "justifyRight" }, 48 { InputEvent::InputType::JustifyRight, "justifyRight" },
47 { InputEvent::InputType::JustifyLeft, "justifyLeft" }, 49 { InputEvent::InputType::JustifyLeft, "justifyLeft" },
48 { InputEvent::InputType::Indent, "indent" }, 50 { InputEvent::InputType::Indent, "indent" },
49 { InputEvent::InputType::Outdent, "outdent" }, 51 { InputEvent::InputType::Outdent, "outdent" },
50 { InputEvent::InputType::RemoveFormat, "removeFormat" }, 52 { InputEvent::InputType::RemoveFormat, "removeFormat" },
51 { InputEvent::InputType::Drag, "drag" },
52 { InputEvent::InputType::JustifyFull, "justifyFull" }, 53 { InputEvent::InputType::JustifyFull, "justifyFull" },
53 { InputEvent::InputType::SetColor, "setColor" }, 54 { InputEvent::InputType::SetColor, "setColor" },
54 { InputEvent::InputType::SetBackgroundColor, "setBackgroundColor" }, 55 { InputEvent::InputType::SetBackgroundColor, "setBackgroundColor" },
55 { InputEvent::InputType::SetFont, "setFont" }, 56 { InputEvent::InputType::SetFont, "setFont" },
56 { InputEvent::InputType::ChangeAttributes, "changeAttributes" }, 57 { InputEvent::InputType::ChangeAttributes, "changeAttributes" },
57 { InputEvent::InputType::SetWritingDirection, "setWritingDirection" }, 58 { InputEvent::InputType::SetWritingDirection, "setWritingDirection" },
58 { InputEvent::InputType::Unscript, "unscript" }, 59 { InputEvent::InputType::Unscript, "unscript" },
59 { InputEvent::InputType::CreateLink, "createLink" }, 60 { InputEvent::InputType::CreateLink, "createLink" },
60 { InputEvent::InputType::Unlink, "unlink" }, 61 { InputEvent::InputType::Unlink, "unlink" },
61 { InputEvent::InputType::FormatBlock, "formatBlock" }, 62 { InputEvent::InputType::FormatBlock, "formatBlock" },
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // 3. We don't want authors to hold live |Range| indefinitely by holding | InputEvent|, so we 213 // 3. We don't want authors to hold live |Range| indefinitely by holding | InputEvent|, so we
213 // clear them after dispatch. 214 // clear them after dispatch.
214 // Authors should explicitly call |getTargetRanges()|->|toRange()| if they w ant to keep a copy of |Range|. 215 // Authors should explicitly call |getTargetRanges()|->|toRange()| if they w ant to keep a copy of |Range|.
215 // See Editing TF meeting notes: 216 // See Editing TF meeting notes:
216 // https://docs.google.com/document/d/1hCj6QX77NYIVY0RWrMHT1Yra6t8_Qu8PopaWL G0AM58/edit?usp=sharing 217 // https://docs.google.com/document/d/1hCj6QX77NYIVY0RWrMHT1Yra6t8_Qu8PopaWL G0AM58/edit?usp=sharing
217 event().m_ranges.clear(); 218 event().m_ranges.clear();
218 return result; 219 return result;
219 } 220 }
220 221
221 } // namespace blink 222 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698