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 3fed4173aa45d23166d9c3c6059364e63f12822f..3c1d4c64405b49d7d1dc71ee5f2ff4a6f3fcc5d6 100644 |
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc |
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc |
@@ -17,6 +17,10 @@ |
#include "ui/base/hit_test.h" |
#include "ui/compositor/layer.h" |
#include "ui/gfx/canvas.h" |
+#include "ui/gfx/display.h" |
+#include "ui/gfx/point_conversions.h" |
+#include "ui/gfx/screen.h" |
+#include "ui/gfx/size_conversions.h" |
#include "ui/native_theme/native_theme.h" |
#include "ui/views/corewm/compound_event_filter.h" |
#include "ui/views/corewm/corewm_switches.h" |
@@ -401,7 +405,16 @@ gfx::Rect DesktopNativeWidgetAura::GetRestoredBounds() const { |
} |
void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) { |
- desktop_root_window_host_->AsRootWindowHost()->SetBounds(bounds); |
+ float scale = 1; |
+ aura::RootWindow* root = root_window_.get(); |
+ if (root) { |
+ scale = gfx::Screen::GetScreenFor(root)-> |
+ GetDisplayNearestWindow(root).device_scale_factor(); |
+ } |
+ gfx::Rect bounds_in_pixels( |
+ gfx::ToCeiledPoint(gfx::ScalePoint(bounds.origin(), scale)), |
+ gfx::ToFlooredSize(gfx::ScaleSize(bounds.size(), scale))); |
+ desktop_root_window_host_->AsRootWindowHost()->SetBounds(bounds_in_pixels); |
} |
void DesktopNativeWidgetAura::SetSize(const gfx::Size& size) { |