diff options
Diffstat (limited to 'chromium/components/spellcheck/renderer/spelling_engine.cc')
-rw-r--r-- | chromium/components/spellcheck/renderer/spelling_engine.cc | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/chromium/components/spellcheck/renderer/spelling_engine.cc b/chromium/components/spellcheck/renderer/spelling_engine.cc index 5d27e2cbede..c2b048bab47 100644 --- a/chromium/components/spellcheck/renderer/spelling_engine.cc +++ b/chromium/components/spellcheck/renderer/spelling_engine.cc @@ -20,29 +20,19 @@ SpellingEngine* CreateNativeSpellingEngine( service_manager::LocalInterfaceProvider* embedder_provider) { DCHECK(embedder_provider); -#if BUILDFLAG(USE_BROWSER_SPELLCHECKER) #if defined(OS_WIN) - if (spellcheck::UseWinHybridSpellChecker()) { - // On Windows, when using the hybrid spellchecker, both Hunspell and the - // platform are used for spellchecking. Ideally we'd want to know which - // languages are supported by the platform spellchecker, and only create a - // HunspellEngine for languages that aren't. Unfortunately, performing that - // check must be done asynchronously on the browser side, while this - // function must return synchronously. However, because the platform - // spellchecker uses a code path that does not involve a SpellingEngine when - // performing spellchecking, a solution is to create a HunspellEngine for - // every language, even those that the platform supports. Because the - // languages that the platform spellchecker supports are initialized on the - // browser side, the HunspellEngine returned here will remain disabled for - // these languages, so they will be skipped when performing the Hunspell - // check. - return new HunspellEngine(embedder_provider); - } else if (spellcheck::UseBrowserSpellChecker()) { - return new PlatformSpellingEngine(embedder_provider); - } -#else - return new PlatformSpellingEngine(embedder_provider); + // On Windows, always return a HunspellEngine. This is a simplification to + // avoid needing an async Mojo call to the browser process to determine which + // languages are supported by the native spell checker. Returning a + // HunspellEngine for languages supported by the native spell checker is + // harmless because the SpellingEngine object returned here is never used + // during native spell checking. It also doesn't affect Hunspell, since these + // languages are skipped during the Hunspell check. + return new HunspellEngine(embedder_provider); #endif // defined(OS_WIN) + +#if BUILDFLAG(USE_BROWSER_SPELLCHECKER) + return new PlatformSpellingEngine(embedder_provider); #endif // BUILDFLAG(USE_BROWSER_SPELLCHECKER) #if BUILDFLAG(USE_RENDERER_SPELLCHECKER) |