From b48e1b8c1aaf9b9ea0f397b57e979ba4384a09e2 Mon Sep 17 00:00:00 2001 From: kochi Date: Mon, 31 Aug 2015 00:32:29 -0700 Subject: Allow default font size changing on Linux. Currently base rendering font size on Linux is hardcoded to 16.0 with no possibility of changing it. This patch add such possibility in RendererPreferences. Webkit part: https://codereview.chromium.org/570243002/ This was once landed and reverted: https://codereview.chromium.org/549303004 (original) https://codereview.chromium.org/1319613004 (revert) due to unexpected default font size change. Now this CL removes the problematic part to derive the default font size from desktop environment. BUG=525176 TBR=joleksy@opera.com, jochen@chromium.org, erg@chromium.org, jln@chromium.org Review URL: https://codereview.chromium.org/1303163008 Cr-Commit-Position: refs/heads/master@{#346353} --- content/common/view_messages.h | 1 + content/public/common/renderer_preferences.cc | 1 + content/public/common/renderer_preferences.h | 2 ++ content/renderer/render_view_linux.cc | 6 ++++++ 4 files changed, 10 insertions(+) (limited to 'content') diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 415c314..cd34d14 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -289,6 +289,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::RendererPreferences) IPC_STRUCT_TRAITS_MEMBER(arrow_bitmap_height_vertical_scroll_bar_in_dips) IPC_STRUCT_TRAITS_MEMBER(arrow_bitmap_width_horizontal_scroll_bar_in_dips) #endif + IPC_STRUCT_TRAITS_MEMBER(default_font_size) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::WebPluginGeometry) diff --git a/content/public/common/renderer_preferences.cc b/content/public/common/renderer_preferences.cc index 48a784d..57c259f 100644 --- a/content/public/common/renderer_preferences.cc +++ b/content/public/common/renderer_preferences.cc @@ -51,6 +51,7 @@ RendererPreferences::RendererPreferences() arrow_bitmap_height_vertical_scroll_bar_in_dips(0), arrow_bitmap_width_horizontal_scroll_bar_in_dips(0) #endif + , default_font_size(0) {} RendererPreferences::~RendererPreferences() { } diff --git a/content/public/common/renderer_preferences.h b/content/public/common/renderer_preferences.h index 1a69081..aaee9d5 100644 --- a/content/public/common/renderer_preferences.h +++ b/content/public/common/renderer_preferences.h @@ -175,6 +175,8 @@ struct CONTENT_EXPORT RendererPreferences { int32 arrow_bitmap_width_horizontal_scroll_bar_in_dips; #endif + // The default font size used for rendering on Linux. + int default_font_size; }; } // namespace content diff --git a/content/renderer/render_view_linux.cc b/content/renderer/render_view_linux.cc index 7f3ab8d..c3b6116 100644 --- a/content/renderer/render_view_linux.cc +++ b/content/renderer/render_view_linux.cc @@ -14,6 +14,8 @@ namespace content { namespace { +const int kMaxDefaultFontSize = 999; + SkPaint::Hinting RendererPreferencesToSkiaHinting( const RendererPreferences& prefs) { if (!prefs.should_antialias_text) { @@ -62,6 +64,10 @@ void RenderViewImpl::UpdateFontRenderingFromRendererPrefs() { prefs.subpixel_rendering != gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE); WebFontRendering::setSubpixelPositioning(prefs.use_subpixel_positioning); + if (prefs.default_font_size > 0 && + prefs.default_font_size <= kMaxDefaultFontSize) { + WebFontRendering::setDefaultFontSize(prefs.default_font_size); + } } } // namespace content -- cgit v1.1