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

Unified Diff: third_party/WebKit/Source/core/editing/commands/TypingCommand.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 tests for InputEvent.data 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/commands/TypingCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
index 03a4cfbed4e1c5db5179a9591c2dcd97316b8410..fa602d7580e1faa4f122ee51ce950f18ab23214f 100644
--- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
@@ -122,6 +122,20 @@ void TypingCommand::forwardDeleteKeyPressed(Document& document, EditingState* ed
TypingCommand::create(document, ForwardDeleteKey, "", options, granularity)->apply();
}
+String TypingCommand::textOfLastCommand() const
+{
+ if (m_commands.isEmpty())
+ return m_textToInsert;
+ if (!m_commands.last()->isCompositeEditCommand())
+ return emptyString();
+
+ const CompositeEditCommand* command = toCompositeEditCommand(m_commands.last());
+ if (!command->isInsertTextCommand())
+ return emptyString();
+
+ return toInsertTextCommand(command)->m_text;
+}
+
void TypingCommand::updateSelectionIfDifferentFromCurrentSelection(TypingCommand* typingCommand, LocalFrame* frame)
{
DCHECK(frame);

Powered by Google App Engine
This is Rietveld 408576698