blob: 40bf7a6d7851f0d3151387f4b87c0102e1f4268e [file] [log] [blame]
ananta99823932015-01-07 02:50:111// Copyright (c) 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
ananta59b9fe72015-04-07 01:33:265#include "content/child/webthemeengine_impl_default.h"
ananta99823932015-01-07 02:50:116#include "content/renderer/render_view_impl.h"
Leon Hanc819dc62019-01-28 04:30:197#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
Blink Reformata30d4232018-04-07 15:31:068#include "third_party/blink/public/web/win/web_font_rendering.h"
bungeman8d44da92016-05-17 15:38:469#include "third_party/skia/include/core/SkFontLCDConfig.h"
scottmga04a4b32015-03-26 22:56:4910#include "ui/gfx/font_render_params.h"
ananta99823932015-01-07 02:50:1111
12using blink::WebFontRendering;
13
14namespace content {
15
16void RenderViewImpl::UpdateFontRenderingFromRendererPrefs() {
Leon Hanc819dc62019-01-28 04:30:1917 const blink::mojom::RendererPreferences& prefs = renderer_preferences_;
ananta3ac61e882015-01-08 14:27:3318
19 // Cache the system font metrics in blink.
Blink Reformat1c4d759e2017-04-09 16:34:5420 blink::WebFontRendering::SetMenuFontMetrics(
ananta3ac61e882015-01-08 14:27:3321 prefs.menu_font_family_name.c_str(), prefs.menu_font_height);
22
Blink Reformat1c4d759e2017-04-09 16:34:5423 blink::WebFontRendering::SetSmallCaptionFontMetrics(
ananta3ac61e882015-01-08 14:27:3324 prefs.small_caption_font_family_name.c_str(),
25 prefs.small_caption_font_height);
26
Blink Reformat1c4d759e2017-04-09 16:34:5427 blink::WebFontRendering::SetStatusFontMetrics(
ananta3ac61e882015-01-08 14:27:3328 prefs.status_font_family_name.c_str(), prefs.status_font_height);
scottmga04a4b32015-03-26 22:56:4929
bungeman8d44da92016-05-17 15:38:4630 SkFontLCDConfig::SetSubpixelOrder(
scottmga04a4b32015-03-26 22:56:4931 gfx::FontRenderParams::SubpixelRenderingToSkiaLCDOrder(
32 prefs.subpixel_rendering));
bungeman8d44da92016-05-17 15:38:4633 SkFontLCDConfig::SetSubpixelOrientation(
scottmga04a4b32015-03-26 22:56:4934 gfx::FontRenderParams::SubpixelRenderingToSkiaLCDOrientation(
35 prefs.subpixel_rendering));
eaee3fe85332016-03-07 18:21:1736
Blink Reformat1c4d759e2017-04-09 16:34:5437 blink::WebFontRendering::SetAntialiasedTextEnabled(
eaee3fe85332016-03-07 18:21:1738 prefs.should_antialias_text);
Blink Reformat1c4d759e2017-04-09 16:34:5439 blink::WebFontRendering::SetLCDTextEnabled(
40 prefs.subpixel_rendering !=
41 gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE);
ananta99823932015-01-07 02:50:1142}
43
scottmgb92365e2016-08-30 20:54:4044void RenderViewImpl::UpdateThemePrefs() {
Christopher Cameronf37f98c2019-05-10 18:41:3945 WebThemeEngineDefault::cacheScrollBarMetrics(
scottmgb92365e2016-08-30 20:54:4046 renderer_preferences_.vertical_scroll_bar_width_in_dips,
47 renderer_preferences_.horizontal_scroll_bar_height_in_dips,
48 renderer_preferences_.arrow_bitmap_height_vertical_scroll_bar_in_dips,
49 renderer_preferences_.arrow_bitmap_width_horizontal_scroll_bar_in_dips);
50}
51
ananta99823932015-01-07 02:50:1152} // namespace content