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

Unified Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 2117543003: [InputEvent] Fill |data| field for 'input' event InsertText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add virtual function |textData()| to |EditCommand| Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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..5c545775a1cef6cebeff559f2aabb9c0b8e1f0e0 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -142,6 +142,13 @@ InputEvent::InputType inputTypeFromCommand(const CompositeEditCommand* command)
return InputEvent::InputType::None;
}
+String dataFromCommand(const CompositeEditCommand* command)
yosin_UTC9 2016/07/06 01:20:55 It seems having |EditCommand::textDataForInputEven
chongz 2016/07/06 23:34:32 Done.
+{
+ if (!command->isTypingCommand() || toTypingCommand(command)->commandTypeOfOpenCommand() != TypingCommand::InsertText)
+ return emptyString();
+ return command->textData();
+}
+
InputEvent::EventIsComposing isComposingFromCommand(const CompositeEditCommand* command)
{
if (command->isTypingCommand() && toTypingCommand(command)->compositionType() != TypingCommand::TextCompositionNone)
@@ -752,8 +759,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.

Powered by Google App Engine
This is Rietveld 408576698