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

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 1426933002: Refactor Windows DPI Point, Rect, and Size for Multiple Monitor DPI Awareness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR Feedback Created 5 years, 2 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: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index ba42e9666c0f4d6cd6772388f5460b19e433264c..5a3c6a4163f9dd9bbcf908cd0b458e59a47018a8 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -59,7 +59,7 @@
#if defined(OS_WIN)
#include "ui/base/win/shell.h"
-#include "ui/gfx/win/dpi.h"
+#include "ui/gfx/screen_win.h"
#endif
DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(VIEWS_EXPORT,
@@ -685,6 +685,12 @@ gfx::Rect DesktopNativeWidgetAura::GetRestoredBounds() const {
void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) {
if (!content_window_)
return;
+#if defined(OS_WIN)
+ // Windows has special scaling rules that do not apply to all platforms to
+ // accommodate multiple monitors with differing DPIs.
+ gfx::Rect bounds_in_pixels =
+ gfx::ScreenWin::DIPToScreenRect(host_->GetAcceleratedWidget(), bounds);
+#else
// TODO(ananta)
// This code by default scales the bounds rectangle by 1.
// We could probably get rid of this and similar logic from
@@ -697,6 +703,7 @@ void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) {
}
gfx::Rect bounds_in_pixels =
gfx::ScaleToEnclosingRect(bounds, scale, scale);
+#endif
desktop_window_tree_host_->AsWindowTreeHost()->SetBounds(bounds_in_pixels);
}

Powered by Google App Engine
This is Rietveld 408576698