Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/Editor.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp |
| index af360607889dfe0a89484963e17705382a367e14..f4b173989700cce780c05c8e0fe74633ba9b1ec4 100644 |
| --- a/third_party/WebKit/Source/core/editing/Editor.cpp |
| +++ b/third_party/WebKit/Source/core/editing/Editor.cpp |
| @@ -142,6 +142,22 @@ InputEvent::InputType inputTypeFromCommand(const CompositeEditCommand* command) |
| return InputEvent::InputType::None; |
| } |
| +String dataFromCommand(const CompositeEditCommand* command) |
| +{ |
| + if (command->isTypingCommand()) { |
|
yosin_UTC9
2016/07/05 01:22:07
nit: To reduce indentation, we could write:
if (!
chongz
2016/07/05 20:33:27
Done.
|
| + const TypingCommand* typingCommand = toTypingCommand(command); |
| + // Only InsertText has |data|. |
| + switch (typingCommand->commandTypeOfOpenCommand()) { |
| + case TypingCommand::InsertText: |
| + return typingCommand->textOfLastCommand(); |
|
yosin_UTC9
2016/07/05 01:22:07
Can we make |textOfLastCommand()| as virtual funct
chongz
2016/07/05 20:33:27
Changed to |textData()|.
|
| + default: |
| + return emptyString(); |
| + } |
| + } |
| + |
| + return emptyString(); |
| +} |
| + |
| InputEvent::EventIsComposing isComposingFromCommand(const CompositeEditCommand* command) |
| { |
| if (command->isTypingCommand() && toTypingCommand(command)->compositionType() != TypingCommand::TextCompositionNone) |
| @@ -752,8 +768,7 @@ void Editor::appliedEditing(CompositeEditCommand* cmd) |
| DCHECK(composition); |
| dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement()); |
| // TODO(chongz): Filter empty InputType after spec is finalized. |
| - // TODO(chongz): Fill in |data| field. |
| - dispatchInputEventEditableContentChanged(composition->startingRootEditableElement(), composition->endingRootEditableElement(), inputTypeFromCommand(cmd), emptyString(), isComposingFromCommand(cmd)); |
| + dispatchInputEventEditableContentChanged(composition->startingRootEditableElement(), composition->endingRootEditableElement(), inputTypeFromCommand(cmd), dataFromCommand(cmd), isComposingFromCommand(cmd)); |
| VisibleSelection newSelection(cmd->endingSelection()); |
| // Don't clear the typing style with this selection change. We do those things elsewhere if necessary. |