Index: chrome/renderer/spellchecker/spellcheck.cc |
diff --git a/chrome/renderer/spellchecker/spellcheck.cc b/chrome/renderer/spellchecker/spellcheck.cc |
index d2895481b9133177f9b7b3b5c0db7d04e0bd3d93..c470ac1c33a0fc98c79796ee6d31041a86713421 100644 |
--- a/chrome/renderer/spellchecker/spellcheck.cc |
+++ b/chrome/renderer/spellchecker/spellcheck.cc |
@@ -46,6 +46,7 @@ class SpellCheck::SpellcheckRequest { |
}; |
SpellCheck::SpellCheck() : auto_spell_correct_turned_on_(false) { |
+ platform_spelling_engine_.reset(CreateNativeSpellingEngine()); |
} |
SpellCheck::~SpellCheck() { |
@@ -90,19 +91,8 @@ void SpellCheck::OnEnableAutoSpellCorrect(bool enable) { |
void SpellCheck::Init(base::PlatformFile file, |
const std::vector<std::string>& custom_words, |
const std::string& language) { |
- bool use_platform_spelling_engine = |
- file == base::kInvalidPlatformFileValue && !language.empty(); |
- |
- // Some tests under OSX still exercise hunspell. Only init native engine |
- // when no dictionary was specified. |
- // TODO(groby): Figure out if we can kill the hunspell dependency for OSX. |
- if (use_platform_spelling_engine) { |
- platform_spelling_engine_.reset(CreateNativeSpellingEngine()); |
- } else { |
- HunspellEngine* engine = new HunspellEngine; |
- engine->Init(file, custom_words); |
- platform_spelling_engine_.reset(engine); |
- } |
+ platform_spelling_engine_->Init(file, custom_words); |
+ |
character_attributes_.SetDefaultLanguage(language); |
text_iterator_.Reset(); |
contraction_iterator_.Reset(); |
@@ -281,13 +271,8 @@ void SpellCheck::RequestTextChecking( |
} |
#endif |
- |
bool SpellCheck::InitializeIfNeeded() { |
- // TODO(groby): OSX creates a hunspell engine here, too. That seems |
- // wrong, but is (AFAICT) the existing flow. Fix that. |
- if (!platform_spelling_engine_.get()) |
- platform_spelling_engine_.reset(new HunspellEngine); |
- |
+ DCHECK(platform_spelling_engine_.get()); |
return platform_spelling_engine_->InitializeIfNeeded(); |
} |
@@ -359,8 +344,8 @@ bool SpellCheck::IsValidContraction(const string16& contraction, int tag) { |
return true; |
} |
-#if !defined(OS_MACOSX) |
void SpellCheck::CreateTextCheckingResults( |
+ ResultFilter filter, |
int line_offset, |
const string16& line_text, |
const std::vector<SpellCheckResult>& spellcheck_results, |
@@ -375,7 +360,8 @@ void SpellCheck::CreateTextCheckingResults( |
static_cast<WebTextCheckingType>(spellcheck_results[i].type); |
int word_location = spellcheck_results[i].location; |
int word_length = spellcheck_results[i].length; |
- if (type == WebKit::WebTextCheckingTypeSpelling) { |
+ if (type == WebKit::WebTextCheckingTypeSpelling && |
+ filter == USE_NATIVE_CHECKER) { |
int misspelling_start = 0; |
int misspelling_length = 0; |
if (SpellCheckWord(text + word_location, word_length, 0, |
@@ -390,4 +376,3 @@ void SpellCheck::CreateTextCheckingResults( |
} |
textcheck_results->swap(list); |
} |
-#endif |