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

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

Issue 14205007: Fix size and positioning of popup windows to work in DIP for Win-Aura in high-DPI mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698