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

Unified Diff: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp

Issue 2711113004: Stop SpellChecker from adding marker when checking range is modified (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/spelling/spellcheck-async-mutation-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
index 32174b63eecb817e2305c8f5980e63edaa9968c7..1e9624648685cc427e3049534186dbf33101a584 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -630,8 +630,20 @@ void SpellChecker::markAndReplaceFor(
DocumentLifecycle::DisallowTransitionScope disallowTransition(
frame().document()->lifecycle());
- TextCheckingParagraph paragraph(request->checkingRange(),
- request->checkingRange());
+ EphemeralRange checkingRange(request->checkingRange());
+
+ // Abort marking if the content of the checking change has been modified.
+ String currentContent =
+ plainText(checkingRange,
+ TextIteratorBehavior::Builder()
+ .setEmitsObjectReplacementCharacter(true)
+ .build());
+ if (currentContent != request->data().text()) {
+ // "editing/spelling/spellcheck-async-mutation.html" reaches here.
+ return;
+ }
+
+ TextCheckingParagraph paragraph(checkingRange, checkingRange);
// TODO(xiaochengh): The following comment does not match the current behavior
// and should be rewritten.
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/spelling/spellcheck-async-mutation-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698