| Index: ui/display/win/screen_win.cc
|
| diff --git a/ui/display/win/screen_win.cc b/ui/display/win/screen_win.cc
|
| index b518fd4d3daa4c91ee1ef2e113574069869a7832..a4ef468fa5d8a3cf6fd7a0decd940dfb1704fac2 100644
|
| --- a/ui/display/win/screen_win.cc
|
| +++ b/ui/display/win/screen_win.cc
|
| @@ -295,6 +295,23 @@ gfx::Size ScreenWin::DIPToScreenSize(HWND hwnd, const gfx::Size& dip_size) {
|
| return ScaleToCeiledSize(dip_size, scale_factor);
|
| }
|
|
|
| +// static
|
| +int ScreenWin::GetSystemMetricsForHwnd(HWND hwnd, int metric) {
|
| + // GetSystemMetrics returns screen values based off of the primary monitor's
|
| + // DPI. This will further scale based off of the DPI for |hwnd|.
|
| + if (!g_screen_win_instance)
|
| + return ::GetSystemMetrics(metric);
|
| +
|
| + Display primary_display(g_screen_win_instance->GetPrimaryDisplay());
|
| + int system_metrics_result = g_screen_win_instance->GetSystemMetrics(metric);
|
| +
|
| + float metrics_relative_scale_factor = hwnd
|
| + ? GetScaleFactorForHWND(hwnd) / primary_display.device_scale_factor()
|
| + : 1.0f;
|
| + return static_cast<int>(std::round(
|
| + system_metrics_result * metrics_relative_scale_factor));
|
| +}
|
| +
|
| HWND ScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const {
|
| NOTREACHED();
|
| return nullptr;
|
| @@ -419,6 +436,10 @@ HWND ScreenWin::GetRootWindow(HWND hwnd) const {
|
| return ::GetAncestor(hwnd, GA_ROOT);
|
| }
|
|
|
| +int ScreenWin::GetSystemMetrics(int metric) const {
|
| + return ::GetSystemMetrics(metric);
|
| +}
|
| +
|
| void ScreenWin::OnWndProc(HWND hwnd,
|
| UINT message,
|
| WPARAM wparam,
|
|
|