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

Unified Diff: components/spellcheck/renderer/spellcheck.cc

Issue 2906243002: Revert of Allow storing multiple replacements on SpellCheckResult (Closed)
Patch Set: Revert "Allow storing multiple replacements on SpellCheckResult" 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: components/spellcheck/renderer/spellcheck.cc
diff --git a/components/spellcheck/renderer/spellcheck.cc b/components/spellcheck/renderer/spellcheck.cc
index e895342f8f08f8f236a985eadec7d03c672e36fc..4ef53a067a6753dd4e5f26b6546e2be2b1e597dd 100644
--- a/components/spellcheck/renderer/spellcheck.cc
+++ b/components/spellcheck/renderer/spellcheck.cc
@@ -473,8 +473,7 @@ void SpellCheck::CreateTextCheckingResults(
const base::string16& misspelled_word =
line_text.substr(spellcheck_result.location, spellcheck_result.length);
- const std::vector<base::string16>& replacements =
- spellcheck_result.replacements;
+ base::string16 replacement = spellcheck_result.replacement;
SpellCheckResult::Decoration decoration = spellcheck_result.decoration;
// Ignore words in custom dictionary.
@@ -483,20 +482,11 @@ void SpellCheck::CreateTextCheckingResults(
continue;
}
- std::vector<WebString> replacements_adjusted;
- for (base::string16 replacement : replacements) {
- // Use the same types of appostrophes as in the mispelled word.
- PreserveOriginalApostropheTypes(misspelled_word, &replacement);
+ // Use the same types of appostrophes as in the mispelled word.
+ PreserveOriginalApostropheTypes(misspelled_word, &replacement);
- // Ignore suggestions that are just changing the apostrophe type
- // (straight vs. typographical)
- if (replacement == misspelled_word)
- continue;
-
- replacements_adjusted.push_back(WebString::FromUTF16(replacement));
- }
-
- if (replacements_adjusted.empty())
+ // Ignore misspellings due the typographical apostrophe.
+ if (misspelled_word == replacement)
continue;
if (filter == USE_NATIVE_CHECKER) {
@@ -514,10 +504,10 @@ void SpellCheck::CreateTextCheckingResults(
}
}
- results.push_back(
- WebTextCheckingResult(static_cast<WebTextDecorationType>(decoration),
- line_offset + spellcheck_result.location,
- spellcheck_result.length, replacements_adjusted));
+ results.push_back(WebTextCheckingResult(
+ static_cast<WebTextDecorationType>(decoration),
+ line_offset + spellcheck_result.location, spellcheck_result.length,
+ blink::WebString::FromUTF16(replacement)));
}
textcheck_results->Assign(results);
« no previous file with comments | « components/spellcheck/common/spellcheck_result.cc ('k') | components/spellcheck/renderer/spellcheck_provider_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698