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

Unified Diff: third_party/WebKit/Source/core/editing/commands/TypingCommand.h

Issue 2530843003: Introduce InsertIncrementalTextCommand to respect existing style for composition (Closed)
Patch Set: Created 4 years, 1 month 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.h
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.h b/third_party/WebKit/Source/core/editing/commands/TypingCommand.h
index 6f57268ed3d375ddb165bcc831128904096fe8d7..cb6964a7a66220a9ddc1f1b4fd8ecfd2678e2b96 100644
--- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.h
+++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.h
@@ -75,13 +75,31 @@ class TypingCommand final : public CompositeEditCommand {
const VisibleSelection&,
Options,
TextCompositionType = TextCompositionNone);
+
+ // When the IME only wants to change a few characters of the composition, only
+ // touch those characters in order to preserve rich text substructure.
+ static void insertIncrementalText(Document&,
+ const String&,
+ const String&,
+ Options,
+ TextCompositionType = TextCompositionNone);
+ static void insertIncrementalText(Document&,
+ const String&,
+ const String&,
+ const VisibleSelection&,
+ Options,
+ TextCompositionType = TextCompositionNone);
static bool insertLineBreak(Document&);
static bool insertParagraphSeparator(Document&);
static bool insertParagraphSeparatorInQuotedContent(Document&);
static void closeTyping(LocalFrame*);
- void insertText(const String& text, bool selectInsertedText, EditingState*);
- void insertTextRunWithoutNewlines(const String& text,
+ void insertText(const String& textToInsert,
+ const String& textForEvent,
+ bool selectInsertedText,
+ EditingState*);
+ void insertTextRunWithoutNewlines(const String& textToInsert,
+ const String& textForEvent,
bool selectInsertedText,
EditingState*);
void insertLineBreak(EditingState*);
@@ -156,8 +174,23 @@ class TypingCommand final : public CompositeEditCommand {
m_commandType = typingCommand;
}
+ static void setSelectionForIncrementalInsertion(TypingCommand*,
+ const VisibleSelection&,
+ LocalFrame*);
+ static void setCommandSelectionForIncrementalInsertion(
+ TypingCommand*,
+ const VisibleSelection&,
+ LocalFrame*);
+
ETypingCommand m_commandType;
+
+ // The text to be inserted.
String m_textToInsert;
+ // The text used to send 'input' event. It could be different with
+ // |m_textToInsert| when applying incremental insertion. In other situations,
+ // they're the same.
+ String m_textForEvent;
+
bool m_openForMoreTyping;
bool m_selectInsertedText;
bool m_smartDelete;
@@ -173,6 +206,8 @@ class TypingCommand final : public CompositeEditCommand {
bool m_shouldRetainAutocorrectionIndicator;
bool m_shouldPreventSpellChecking;
+
+ static bool m_isIncrementalInsertion;
};
DEFINE_TYPE_CASTS(TypingCommand,

Powered by Google App Engine
This is Rietveld 408576698