Chromium Code Reviews| Index: components/spellcheck/renderer/spellcheck.cc |
| diff --git a/components/spellcheck/renderer/spellcheck.cc b/components/spellcheck/renderer/spellcheck.cc |
| index cc9b238245aaccd1cec612b44ef5483e055b8b77..fe6f68e43cefa88c4ec24527e8aad104032fe542 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); |
| + bool skip_these_replacements = false; |
| + 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 misspellings due the typographical apostrophe. |
| + if (replacement == misspelled_word) { |
| + skip_these_replacements = true; |
| + continue; |
| + } |
| + |
| + replacements_adjusted.push_back(WebString::FromUTF16(replacement)); |
| + } |
| + |
| + if (skip_these_replacements) |
|
groby-ooo-7-16
2017/04/28 23:45:55
I believe this is wrong - with your change, if *an
rlanday
2017/05/01 20:40:01
My thinking was that if the spellchecker thinks th
groby-ooo-7-16
2017/05/08 15:31:22
What we currently do is that for all replacements,
|
| 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); |