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

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

Issue 2911253003: [Reland] Allow storing multiple replacements on SpellCheckResult (Closed)
Patch Set: Fix typo Created 3 years, 7 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/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 a72600abe25ab1a9862fb70b50d3cb18a52e228f..5aa357810027cfd4c86ecf4282189e4649bd95fb 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -536,7 +536,7 @@ static void AddMarker(Document* document,
DocumentMarker::MarkerType type,
int location,
int length,
- const String& description) {
+ const Vector<String>& descriptions) {
DCHECK(type == DocumentMarker::kSpelling || type == DocumentMarker::kGrammar)
<< type;
DCHECK_GT(length, 0);
@@ -548,6 +548,13 @@ static void AddMarker(Document* document,
if (!SpellChecker::IsSpellCheckingEnabledAt(range_to_mark.EndPosition()))
return;
+ String description;
+ for (size_t i = 0; i < descriptions.size(); ++i) {
+ if (i != 0)
+ description.append('\n');
+ description.append(descriptions[i]);
+ }
+
if (type == DocumentMarker::kSpelling) {
document->Markers().AddSpellingMarker(range_to_mark, description);
return;
@@ -643,7 +650,7 @@ void SpellChecker::MarkAndReplaceFor(
continue;
AddMarker(GetFrame().GetDocument(), paragraph.CheckingRange(),
DocumentMarker::kSpelling, result_location, result_length,
- result.replacement);
+ result.replacements);
continue;
case kTextDecorationTypeGrammar:
@@ -659,7 +666,7 @@ void SpellChecker::MarkAndReplaceFor(
continue;
AddMarker(GetFrame().GetDocument(), paragraph.CheckingRange(),
DocumentMarker::kGrammar, result_location + detail.location,
- detail.length, result.replacement);
+ detail.length, result.replacements);
}
continue;
}

Powered by Google App Engine
This is Rietveld 408576698