Index: components/spellcheck/renderer/spellcheck.cc |
diff --git a/components/spellcheck/renderer/spellcheck.cc b/components/spellcheck/renderer/spellcheck.cc |
index cc9b238245aaccd1cec612b44ef5483e055b8b77..e2cbf7662e61968fb96522992d48b8bee414b950 100644 |
--- a/components/spellcheck/renderer/spellcheck.cc |
+++ b/components/spellcheck/renderer/spellcheck.cc |
@@ -461,7 +461,8 @@ void SpellCheck::CreateTextCheckingResults( |
const base::string16& misspelled_word = |
line_text.substr(spellcheck_result.location, spellcheck_result.length); |
- base::string16 replacement = spellcheck_result.replacement; |
+ const std::vector<base::string16>& replacements = |
+ spellcheck_result.replacements; |
SpellCheckResult::Decoration decoration = spellcheck_result.decoration; |
// Ignore words in custom dictionary. |
@@ -470,11 +471,22 @@ void SpellCheck::CreateTextCheckingResults( |
continue; |
} |
- // Use the same types of appostrophes as in the mispelled word. |
- PreserveOriginalApostropheTypes(misspelled_word, &replacement); |
+ 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); |
- // Ignore misspellings due the typographical apostrophe. |
- if (misspelled_word == replacement) |
+ // Ignore suggestions that just change between straight and typographic |
+ // apostrophes |
+ if (misspelled_word == replacement) |
+ continue; |
+ |
+ replacements_adjusted.push_back(WebString::FromUTF16(replacement)); |
+ } |
+ |
+ // If there was at least one suggested replacement, but all suggestions were |
+ // just changing apostrophe styles, ignore this misspelling |
+ if (!replacements.empty() && replacements_adjusted.empty()) |
continue; |
if (filter == USE_NATIVE_CHECKER) { |
@@ -492,10 +504,10 @@ void SpellCheck::CreateTextCheckingResults( |
} |
} |
- results.push_back(WebTextCheckingResult( |
- static_cast<WebTextDecorationType>(decoration), |
- line_offset + spellcheck_result.location, spellcheck_result.length, |
- blink::WebString::FromUTF16(replacement))); |
+ results.push_back( |
+ WebTextCheckingResult(static_cast<WebTextDecorationType>(decoration), |
+ line_offset + spellcheck_result.location, |
+ spellcheck_result.length, replacements_adjusted)); |
} |
textcheck_results->Assign(results); |