| Index: chrome/renderer/spellchecker/spellcheck.cc
|
| diff --git a/chrome/renderer/spellchecker/spellcheck.cc b/chrome/renderer/spellchecker/spellcheck.cc
|
| index 4b45c2bbffb32757ffa05d7e15b464575abff3c3..619cbea15ed87f7bab9b08855de7afbc62bec6de 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() {
|
| @@ -87,19 +88,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();
|
| @@ -277,13 +267,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();
|
| }
|
|
|
| @@ -352,8 +337,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,
|
| @@ -368,7 +353,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,
|
| @@ -383,4 +369,3 @@ void SpellCheck::CreateTextCheckingResults(
|
| }
|
| textcheck_results->swap(list);
|
| }
|
| -#endif
|
|
|