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

Unified Diff: ui/gfx/screen_win.cc

Issue 11829040: Fix the content_browsertests everywhere maybe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 7 years, 11 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
« no previous file with comments | « ui/aura/window.cc ('k') | ui/views/examples/content_client/examples_browser_main_parts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/screen_win.cc
diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc
index 9b33c6b20024f5154671e19c4e3202ef20917952..80614a4bf34a892a2a4fc506fa7a83cbafd26fff 100644
--- a/ui/gfx/screen_win.cc
+++ b/ui/gfx/screen_win.cc
@@ -57,6 +57,13 @@ int ScreenWin::GetNumDisplays() {
gfx::Display ScreenWin::GetDisplayNearestWindow(gfx::NativeView window) const {
HWND window_hwnd = GetHWNDFromNativeView(window);
+ if (!window_hwnd) {
+ // When |window| isn't rooted to a display, we should just return the
+ // default display so we get some correct display information like the
+ // scaling factor.
+ return GetPrimaryDisplay();
+ }
+
MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(monitor_info);
GetMonitorInfo(MonitorFromWindow(window_hwnd, MONITOR_DEFAULTTONEAREST),
« no previous file with comments | « ui/aura/window.cc ('k') | ui/views/examples/content_client/examples_browser_main_parts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698