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

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

Issue 2558643003: [InputEvent] Move 'beforeinput' logic into |CompositeEditCommand::willApplyEditing()| (3/3) (Closed)
Patch Set: yosin's review, fix nits Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
index 29a17ac75d586f4724334baaaa8010122d4aa1ac..2649849c3e1c27cf136927745dd68330137a46fe 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -201,8 +201,9 @@ bool CompositeEditCommand::apply() {
case InputEvent::InputType::DeleteComposedCharacterBackward:
case InputEvent::InputType::DeleteWordBackward:
case InputEvent::InputType::DeleteWordForward:
- case InputEvent::InputType::DeleteLineBackward:
- case InputEvent::InputType::DeleteLineForward:
+ case InputEvent::InputType::DeleteSoftLineBackward:
+ case InputEvent::InputType::DeleteSoftLineForward:
+ case InputEvent::InputType::DeleteContent:
case InputEvent::InputType::DeleteContentBackward:
case InputEvent::InputType::DeleteContentForward:
case InputEvent::InputType::DeleteByCut:
@@ -223,6 +224,11 @@ bool CompositeEditCommand::apply() {
// the creation of VisiblePositions).
document().updateStyleAndLayoutIgnorePendingStylesheets();
+ // Covers the initial TypingCommand and other top-level commands.
+ // See TypingCommand::willAddTypingToOpenCommand().
+ if (!willApply())
+ return false;
+
LocalFrame* frame = document().frame();
DCHECK(frame);
EditingState editingState;
@@ -430,6 +436,10 @@ void CompositeEditCommand::insertNodeAt(Node* insertChild,
}
}
+bool CompositeEditCommand::willApply() {
+ return document().frame()->editor().willApplyEditing(this);
+}
+
void CompositeEditCommand::appendNode(Node* node,
ContainerNode* parent,
EditingState* editingState) {

Powered by Google App Engine
This is Rietveld 408576698