1 // 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.
5 #include "content/public/common/renderer_preferences.h"
6 #include "content/child/webthemeengine_impl_default.h"
7 #include "content/renderer/render_view_impl.h"
8 #include "third_party/WebKit/public/web/win/WebFontRendering.h"
9 #include "ui/gfx/font_render_params.h"
11 using blink::WebFontRendering
;
15 void RenderViewImpl::UpdateFontRenderingFromRendererPrefs() {
16 const RendererPreferences
& prefs
= renderer_preferences_
;
18 // Cache the system font metrics in blink.
19 blink::WebFontRendering::setMenuFontMetrics(
20 prefs
.menu_font_family_name
.c_str(), prefs
.menu_font_height
);
22 blink::WebFontRendering::setSmallCaptionFontMetrics(
23 prefs
.small_caption_font_family_name
.c_str(),
24 prefs
.small_caption_font_height
);
26 blink::WebFontRendering::setStatusFontMetrics(
27 prefs
.status_font_family_name
.c_str(), prefs
.status_font_height
);
29 blink::WebFontRendering::setLCDOrder(
30 gfx::FontRenderParams::SubpixelRenderingToSkiaLCDOrder(
31 prefs
.subpixel_rendering
));
32 blink::WebFontRendering::setLCDOrientation(
33 gfx::FontRenderParams::SubpixelRenderingToSkiaLCDOrientation(
34 prefs
.subpixel_rendering
));
37 void RenderViewImpl::UpdateThemePrefs() {
38 WebThemeEngineImpl::cacheScrollBarMetrics(
39 renderer_preferences_
.vertical_scroll_bar_width_in_dips
,
40 renderer_preferences_
.horizontal_scroll_bar_height_in_dips
,
41 renderer_preferences_
.arrow_bitmap_height_vertical_scroll_bar_in_dips
,
42 renderer_preferences_
.arrow_bitmap_width_horizontal_scroll_bar_in_dips
);
45 } // namespace content