Commit 59e35e03 authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen
Browse files

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: default avatarJoerg Bornemann <joerg.bornemann@qt.io>
Showing with 10 additions and 0 deletions
......@@ -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.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment