diff options
author | Szabolcs David <davidsz@inf.u-szeged.hu> | 2022-08-12 12:00:34 +0200 |
---|---|---|
committer | Szabolcs David <davidsz@inf.u-szeged.hu> | 2022-08-16 13:04:02 +0200 |
commit | 53222c866466345baadc85c1cf2120822cae0415 (patch) | |
tree | 84ab7d0af582b502735cb91f9fbdd40cbcba1d9b /src/core/content_browser_client_qt.cpp | |
parent | 0b959ca4add9859da9cf92942330253c6d812f22 (diff) |
Native spellchecker: Fix it when disabled
SpellCheck is enabled by default "due to peculiarities of the
initialization sequence" (see the ctor in
components/spellcheck/renderer/spellcheck.cc). It produces red underlines
on the fist user interaction even if we disable it from WebEngineProfile,
then the lazily initialized SpellcheckService disables it correctly.
Initialize the service early for this particular case to avoid undesired
spellchecking.
Change-Id: Ib2e38fb381d9b169f8f59c8100b4df7af3493aa1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index fdca05760..67fd8456d 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -98,7 +98,11 @@ #if QT_CONFIG(webengine_spellchecker) #include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h" +#include "chrome/browser/spellchecker/spellcheck_factory.h" +#include "chrome/browser/spellchecker/spellcheck_service.h" +#include "components/spellcheck/browser/pref_names.h" #include "components/spellcheck/common/spellcheck.mojom.h" +#include "components/spellcheck/common/spellcheck_features.h" #endif #if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) @@ -221,6 +225,10 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost const int id = host->GetID(); Profile *profile = Profile::FromBrowserContext(host->GetBrowserContext()); + if (spellcheck::UseBrowserSpellChecker() && !profile->GetPrefs()->GetBoolean(spellcheck::prefs::kSpellCheckEnable)) + SpellcheckServiceFactory::GetForContext(profile)->InitForRenderer(host); + + #if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) WebRtcLoggingController::AttachToRenderProcessHost(host, WebEngineContext::current()->webRtcLogUploader()); #endif |