diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-08-03 10:40:38 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-08-03 14:24:09 +0000 |
commit | 59e35e033b8c8327db5b3fdbfb5d6ecee48a4405 (patch) | |
tree | 7e5b0c50d2990c0fd3e9c096030c1c62d16004ab | |
parent | b238f224a7827de182e8ac77ffac31d9ae25ce57 (diff) |
Set web contents font setting to default
Chromium has since version 50 overridden the global font settings with
the settings of every web contents created, so we need to first set the
global settings in the web contents, to still follow system defaults.
Task-number: QTBUG-62146
Change-Id: If10847c81beda08ecb7bfdf7556e39b1d2989754
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/core/web_contents_adapter.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index a788b9679..8273b247f 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -83,6 +83,7 @@ #include "content/public/common/web_preferences.h" #include "third_party/WebKit/public/web/WebFindOptions.h" #include "printing/features/features.h" +#include "ui/gfx/font_render_params.h" #include <QDir> #include <QGuiApplication> @@ -425,6 +426,15 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient) if (commandLine->HasSwitch(switches::kForceWebRtcIPHandlingPolicy)) rendererPrefs->webrtc_ip_handling_policy = commandLine->GetSwitchValueASCII(switches::kForceWebRtcIPHandlingPolicy); #endif + // Set web-contents font settings to the default font settings as Chromium constantly overrides + // the global font defaults with the font settings of the latest web-contents created. + CR_DEFINE_STATIC_LOCAL(const gfx::FontRenderParams, params, (gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), NULL))); + rendererPrefs->should_antialias_text = params.antialiasing; + rendererPrefs->use_subpixel_positioning = params.subpixel_positioning; + rendererPrefs->hinting = params.hinting; + rendererPrefs->use_autohinter = params.autohinter; + rendererPrefs->use_bitmaps = params.use_bitmaps; + rendererPrefs->subpixel_rendering = params.subpixel_rendering; d->webContents->GetRenderViewHost()->SyncRendererPrefs(); // Create and attach observers to the WebContents. |