Commit 164416f1 authored by kevers@chromium.org's avatar kevers@chromium.org

Fix size and positioning of popup windows to work in DIP for Win-Aura in high-DPI mode.

BUG=232434

Review URL: https://chromiumcodereview.appspot.com/14205007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195226 0039d316-1c4b-4281-b951-d872f2087c98
parent dd7ae928
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
#include "ui/base/hit_test.h" #include "ui/base/hit_test.h"
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
#include "ui/gfx/canvas.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/native_theme/native_theme.h"
#include "ui/views/corewm/compound_event_filter.h" #include "ui/views/corewm/compound_event_filter.h"
#include "ui/views/corewm/corewm_switches.h" #include "ui/views/corewm/corewm_switches.h"
...@@ -401,7 +405,16 @@ gfx::Rect DesktopNativeWidgetAura::GetRestoredBounds() const { ...@@ -401,7 +405,16 @@ gfx::Rect DesktopNativeWidgetAura::GetRestoredBounds() const {
} }
void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) { 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) { void DesktopNativeWidgetAura::SetSize(const gfx::Size& size) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment