From 59e35e033b8c8327db5b3fdbfb5d6ecee48a4405 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 3 Aug 2017 10:40:38 +0200 Subject: 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 --- src/core/web_contents_adapter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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 #include @@ -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. -- cgit v1.2.3