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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp

Issue 2768303003: [InputEvent] Allow transpose and yank in plain-text field (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-yank.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 bool CompositeEditCommand::apply() { 94 bool CompositeEditCommand::apply() {
95 DCHECK(!isCommandGroupWrapper()); 95 DCHECK(!isCommandGroupWrapper());
96 if (!endingSelection().isContentRichlyEditable()) { 96 if (!endingSelection().isContentRichlyEditable()) {
97 switch (inputType()) { 97 switch (inputType()) {
98 case InputEvent::InputType::InsertText: 98 case InputEvent::InputType::InsertText:
99 case InputEvent::InputType::InsertLineBreak: 99 case InputEvent::InputType::InsertLineBreak:
100 case InputEvent::InputType::InsertParagraph: 100 case InputEvent::InputType::InsertParagraph:
101 case InputEvent::InputType::InsertFromPaste: 101 case InputEvent::InputType::InsertFromPaste:
102 case InputEvent::InputType::InsertFromDrop: 102 case InputEvent::InputType::InsertFromDrop:
103 case InputEvent::InputType::InsertFromYank:
yosin_UTC9 2017/03/24 01:26:48 BTW, Do we really need to have this switch-stateme
chongz 2017/03/24 14:57:20 This pattern was originated from WebKit, see: http
104 case InputEvent::InputType::InsertTranspose:
103 case InputEvent::InputType::InsertReplacementText: 105 case InputEvent::InputType::InsertReplacementText:
104 case InputEvent::InputType::InsertCompositionText: 106 case InputEvent::InputType::InsertCompositionText:
105 case InputEvent::InputType::DeleteWordBackward: 107 case InputEvent::InputType::DeleteWordBackward:
106 case InputEvent::InputType::DeleteWordForward: 108 case InputEvent::InputType::DeleteWordForward:
107 case InputEvent::InputType::DeleteLineBackward: 109 case InputEvent::InputType::DeleteLineBackward:
108 case InputEvent::InputType::DeleteLineForward: 110 case InputEvent::InputType::DeleteLineForward:
109 case InputEvent::InputType::DeleteContentBackward: 111 case InputEvent::InputType::DeleteContentBackward:
110 case InputEvent::InputType::DeleteContentForward: 112 case InputEvent::InputType::DeleteContentForward:
111 case InputEvent::InputType::DeleteByCut: 113 case InputEvent::InputType::DeleteByCut:
112 case InputEvent::InputType::DeleteByDrag: 114 case InputEvent::InputType::DeleteByDrag:
113 case InputEvent::InputType::None: 115 case InputEvent::InputType::None:
114 break; 116 break;
115 default: 117 default:
116 NOTREACHED(); 118 NOTREACHED() << "Not supported input type on plain-text only element:"
119 << static_cast<int>(inputType());
117 return false; 120 return false;
118 } 121 }
119 } 122 }
120 ensureUndoStep(); 123 ensureUndoStep();
121 124
122 // Changes to the document may have been made since the last editing operation 125 // Changes to the document may have been made since the last editing operation
123 // that require a layout, as in <rdar://problem/5658603>. Low level 126 // that require a layout, as in <rdar://problem/5658603>. Low level
124 // operations, like RemoveNodeCommand, don't require a layout because the high 127 // operations, like RemoveNodeCommand, don't require a layout because the high
125 // level operations that use them perform one if one is necessary (like for 128 // level operations that use them perform one if one is necessary (like for
126 // the creation of VisiblePositions). 129 // the creation of VisiblePositions).
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 1965
1963 DEFINE_TRACE(CompositeEditCommand) { 1966 DEFINE_TRACE(CompositeEditCommand) {
1964 visitor->trace(m_commands); 1967 visitor->trace(m_commands);
1965 visitor->trace(m_startingSelection); 1968 visitor->trace(m_startingSelection);
1966 visitor->trace(m_endingSelection); 1969 visitor->trace(m_endingSelection);
1967 visitor->trace(m_undoStep); 1970 visitor->trace(m_undoStep);
1968 EditCommand::trace(visitor); 1971 EditCommand::trace(visitor);
1969 } 1972 }
1970 1973
1971 } // namespace blink 1974 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-yank.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698