Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1107)

Unified Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 1054243002: Avoid calling the GetSystemMetrics API in the renderer process on Windows to get the scrollbar metr… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary include Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index cdc82e9fd70e405aa7aaa81a6964cbe4ebbae1fa..43baae9b82c27a47d092d77bf23a859b66c176a3 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -89,6 +89,8 @@
#if defined(OS_WIN)
#include "base/win/win_util.h"
+#include "ui/gfx/platform_font_win.h"
+#include "ui/gfx/win/dpi.h"
#endif
using base::TimeDelta;
@@ -124,6 +126,40 @@ void DismissVirtualKeyboardTask() {
}
}
}
+
+void GetWindowsSpecificPrefs(RendererPreferences* prefs) {
+ NONCLIENTMETRICS_XP metrics = {0};
+ base::win::GetNonClientMetrics(&metrics);
+
+ prefs->caption_font_family_name = metrics.lfCaptionFont.lfFaceName;
+ prefs->caption_font_height = gfx::PlatformFontWin::GetFontSize(
+ metrics.lfCaptionFont);
+
+ prefs->small_caption_font_family_name = metrics.lfSmCaptionFont.lfFaceName;
+ prefs->small_caption_font_height = gfx::PlatformFontWin::GetFontSize(
+ metrics.lfSmCaptionFont);
+
+ prefs->menu_font_family_name = metrics.lfMenuFont.lfFaceName;
+ prefs->menu_font_height = gfx::PlatformFontWin::GetFontSize(
+ metrics.lfMenuFont);
+
+ prefs->status_font_family_name = metrics.lfStatusFont.lfFaceName;
+ prefs->status_font_height = gfx::PlatformFontWin::GetFontSize(
+ metrics.lfStatusFont);
+
+ prefs->message_font_family_name = metrics.lfMessageFont.lfFaceName;
+ prefs->message_font_height = gfx::PlatformFontWin::GetFontSize(
+ metrics.lfMessageFont);
+
+ prefs->vertical_scroll_bar_width_in_dips =
+ gfx::win::GetSystemMetricsInDIP(SM_CXVSCROLL);
+ prefs->horizontal_scroll_bar_height_in_dips =
+ gfx::win::GetSystemMetricsInDIP(SM_CYHSCROLL);
+ prefs->arrow_bitmap_height_vertical_scroll_bar_in_dips =
+ gfx::win::GetSystemMetricsInDIP(SM_CYVSCROLL);
+ prefs->arrow_bitmap_width_horizontal_scroll_bar_in_dips =
+ gfx::win::GetSystemMetricsInDIP(SM_CXHSCROLL);
+}
#endif
} // namespace
@@ -267,6 +303,9 @@ bool RenderViewHostImpl::CreateRenderView(
ViewMsg_New_Params params;
params.renderer_preferences =
delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext());
+#if defined(OS_WIN)
+ GetWindowsSpecificPrefs(&params.renderer_preferences);
+#endif
params.web_preferences = GetWebkitPreferences();
params.view_id = GetRoutingID();
params.main_frame_routing_id = main_frame_routing_id_;

Powered by Google App Engine
This is Rietveld 408576698