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

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

Issue 2848943002: Allow storing multiple replacements on SpellCheckResult (Closed)
Patch Set: 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/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 71a48a56cc62fbfd9098153f1efa18d809a453f9..dcdeea76139141acdfc23d338e2a4ed057e1bea8 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -538,7 +538,7 @@ static void AddMarker(Document* document,
DocumentMarker::MarkerType type,
int location,
int length,
- const String& description) {
+ const Vector<String>& descriptions) {
DCHECK_GT(length, 0);
DCHECK_GE(location, 0);
const EphemeralRange& range_to_mark =
@@ -547,6 +547,14 @@ static void AddMarker(Document* document,
return;
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]);
+ }
+
document->Markers().AddMarker(range_to_mark.StartPosition(),
range_to_mark.EndPosition(), type, description);
}
@@ -634,7 +642,7 @@ void SpellChecker::MarkAndReplaceFor(
continue;
AddMarker(GetFrame().GetDocument(), paragraph.CheckingRange(),
DocumentMarker::kSpelling, result_location, result_length,
- result.replacement);
+ result.replacements);
continue;
case kTextDecorationTypeGrammar:
@@ -650,7 +658,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