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

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

Issue 2583993002: [Editing] Introduce |CompositeEditCommand::willApplyEditing()| in prepare for 'beforeinput' (1/3) (Closed)
Patch Set: Add TODO, remove |willApply()| 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 e5bd64d18911c0fdada87faebfc8e658c3a56331..8e9f33a1e1d1e1348aee20a445f9137a3502cd4a 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -187,8 +187,7 @@ CompositeEditCommand::~CompositeEditCommand() {
DCHECK(isTopLevelCommand() || !m_composition);
}
-// TODO(chongz): Fire 'beforeinput' based on |EditCommandSource|.
-bool CompositeEditCommand::apply(EditCommandSource) {
+bool CompositeEditCommand::apply(EditCommandSource source) {
DCHECK(!isCommandGroupWrapper());
if (!endingSelection().isContentRichlyEditable()) {
switch (inputType()) {
@@ -224,6 +223,9 @@ bool CompositeEditCommand::apply(EditCommandSource) {
// the creation of VisiblePositions).
document().updateStyleAndLayoutIgnorePendingStylesheets();
+ if (!willApplyEditing(source))
+ return false;
+
LocalFrame* frame = document().frame();
DCHECK(frame);
EditingState editingState;
@@ -250,6 +252,11 @@ EditCommandComposition* CompositeEditCommand::ensureComposition() {
return command->m_composition.get();
}
+bool CompositeEditCommand::willApplyEditing(EditCommandSource) {
+ // TODO(chongz): Move all the 'beforeinput' dispatching logic here.
+ return true;
+}
+
bool CompositeEditCommand::preservesTypingStyle() const {
return false;
}

Powered by Google App Engine
This is Rietveld 408576698