Index: chrome/renderer/spellchecker/spellcheck.cc |
diff --git a/chrome/renderer/spellchecker/spellcheck.cc b/chrome/renderer/spellchecker/spellcheck.cc |
index e8e283a0bec76c02dd91554c1e1362b32b065ab6..6ec12f401dcc36bd48a89bd2aa14527beed420e7 100644 |
--- a/chrome/renderer/spellchecker/spellcheck.cc |
+++ b/chrome/renderer/spellchecker/spellcheck.cc |
@@ -4,6 +4,8 @@ |
#include "chrome/renderer/spellchecker/spellcheck.h" |
+#include <algorithm> |
+ |
#include "base/bind.h" |
#include "base/message_loop/message_loop_proxy.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -393,11 +395,26 @@ void SpellCheck::CreateTextCheckingResults( |
int misspelling_length = 0; |
if (decoration == SpellCheckResult::SPELLING && |
filter == USE_NATIVE_CHECKER) { |
+ // Ignore typographical apostrophe misspellings. |
groby-ooo-7-16
2015/04/20 21:02:22
Eeew. Are all languages handling typographic apost
please use gerrit instead
2015/04/20 23:05:31
SpellcheckWordIterator says it's using ICU for wor
please use gerrit instead
2015/04/20 23:40:17
By the way, we can remove this hack once the serve
|
+ static const base::char16 kTypographicalApostrophe = 0x2019; |
+ static const base::char16 kTypewriterApostrophe = 0x0027; |
+ if (line_text.find(kTypographicalApostrophe, word_location) < |
+ static_cast<size_t>(word_location + word_length)) { |
+ base::string16 no_typographical_apostrophe(line_text, word_location, |
+ word_length); |
+ std::replace(no_typographical_apostrophe.begin(), |
+ no_typographical_apostrophe.end(), |
+ kTypographicalApostrophe, kTypewriterApostrophe); |
+ if (no_typographical_apostrophe == spellcheck_results[i].replacement) |
+ continue; |
+ } |
+ |
if (SpellCheckWord(text + word_location, word_length, 0, |
&misspelling_start, &misspelling_length, NULL)) { |
decoration = SpellCheckResult::GRAMMAR; |
} |
} |
+ |
if (!custom_dictionary_.SpellCheckWord( |
line_text, word_location, word_length)) { |
list.push_back(WebTextCheckingResult( |