Chromium Code Reviews| 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..fa919f3c16bb407f5c0d0bc4c2d3f13bf6cca830 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 (!willApply(source)) |
| + return false; |
| + |
| LocalFrame* frame = document().frame(); |
| DCHECK(frame); |
| EditingState editingState; |
| @@ -250,6 +252,15 @@ EditCommandComposition* CompositeEditCommand::ensureComposition() { |
| return command->m_composition.get(); |
| } |
| +bool CompositeEditCommand::willApply(EditCommandSource source) { |
| + return willApplyEditing(source); |
|
tkent
2016/12/19 03:43:24
What's the difference between willApply() and will
chongz
2016/12/19 06:48:57
The reason is both |TypingCommand::willAddTypingTo
tkent
2016/12/19 08:22:18
It didn't convince me.
Why CompositeEditCommand::
chongz
2016/12/19 20:55:22
Oh I got what you mean. Yeah we don't need |willAp
|
| +} |
| + |
| +bool CompositeEditCommand::willApplyEditing(EditCommandSource) { |
| + // TODO(chongz): Move all the 'beforeinput' dispatching logic here. |
| + return true; |
| +} |
| + |
| bool CompositeEditCommand::preservesTypingStyle() const { |
| return false; |
| } |