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

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

Issue 2650113004: [WIP] Add support for Android SuggestionSpans when editing text (Closed)
Patch Set: Uploading the latest version from my repo so I can reference it Created 3 years, 8 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 5d0c85686a345b6edbb41d7c3b46bb40eaa3ee0f..2687acad99fa8b707d9f38454d862641e5d4b7ff 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -46,6 +46,7 @@
#include "core/editing/EditingUtilities.h"
#include "core/editing/InputMethodController.h"
#include "core/editing/RenderedPosition.h"
+#include "core/editing/TextSuggestionController.h"
#include "core/editing/VisibleUnits.h"
#include "core/editing/commands/ApplyStyleCommand.h"
#include "core/editing/commands/DeleteSelectionCommand.h"
@@ -763,7 +764,9 @@ void Editor::respondToChangedContents(const Position& position) {
cache->handleEditableTextContentChanged(node);
}
- spellChecker().respondToChangedContents();
+ spellChecker().updateMarkersForWordsAffectedByEditing(true);
+ frame().textSuggestionController().removeSuggestionMarkersAffectedByEditing(
+ true);
client().respondToChangedContents();
}
@@ -1044,8 +1047,11 @@ bool Editor::insertTextWithoutSendingTextEvent(
if (!selection.isContentEditable())
return false;
+ bool firstCharIsSpaceOrNewline = isSpaceOrNewline(text[0]);
spellChecker().updateMarkersForWordsAffectedByEditing(
- isSpaceOrNewline(text[0]));
+ firstCharIsSpaceOrNewline);
+ frame().textSuggestionController().removeSuggestionMarkersAffectedByEditing(
+ firstCharIsSpaceOrNewline);
// Insert the text
TypingCommand::insertText(
@@ -1126,6 +1132,8 @@ void Editor::cut(EditorCommandSource source) {
// TODO(yosin) We should use early return style here.
if (canDeleteRange(selectedRange())) {
spellChecker().updateMarkersForWordsAffectedByEditing(true);
+ frame().textSuggestionController().removeSuggestionMarkersAffectedByEditing(
+ true);
if (enclosingTextControl(frame()
.selection()
.computeVisibleSelectionInDOMTreeDeprecated()
@@ -1192,6 +1200,8 @@ void Editor::paste(EditorCommandSource source) {
if (!canPaste())
return;
spellChecker().updateMarkersForWordsAffectedByEditing(false);
+ frame().textSuggestionController().removeSuggestionMarkersAffectedByEditing(
+ false);
ResourceFetcher* loader = frame().document()->fetcher();
ResourceCacheValidationSuppressor validationSuppressor(loader);
@@ -1228,6 +1238,8 @@ void Editor::pasteAsPlainText(EditorCommandSource source) {
if (!canPaste())
return;
spellChecker().updateMarkersForWordsAffectedByEditing(false);
+ frame().textSuggestionController().removeSuggestionMarkersAffectedByEditing(
+ false);
pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
}

Powered by Google App Engine
This is Rietveld 408576698