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

Unified Diff: ui/aura/window_tree_host.cc

Issue 2263453002: Use enclosing rect to find WindowTreeHost size. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unit test Created 4 years, 4 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/BUILD.gn ('k') | ui/aura/window_tree_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_tree_host.cc
diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc
index d8f9940ceb4c12b278ffce05de5907ad666d1355..5164fe65a58cac4cbe9a61f1ce84d2dd04f955c4 100644
--- a/ui/aura/window_tree_host.cc
+++ b/ui/aura/window_tree_host.cc
@@ -24,6 +24,7 @@
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point3_f.h"
#include "ui/gfx/geometry/point_conversions.h"
+#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
namespace aura {
@@ -114,10 +115,11 @@ void WindowTreeHost::UpdateRootWindowSize(const gfx::Size& host_size) {
gfx::Rect bounds(output_surface_padding_.left(),
output_surface_padding_.top(), host_size.width(),
host_size.height());
- gfx::RectF new_bounds(ui::ConvertRectToDIP(window()->layer(), bounds));
+ float scale_factor = ui::GetDeviceScaleFactor(window()->layer());
+ gfx::RectF new_bounds =
+ gfx::ScaleRect(gfx::RectF(bounds), 1.0f / scale_factor);
window()->layer()->transform().TransformRect(&new_bounds);
- window()->SetBounds(gfx::Rect(gfx::ToFlooredPoint(new_bounds.origin()),
- gfx::ToFlooredSize(new_bounds.size())));
+ window()->SetBounds(gfx::ToEnclosingRect(new_bounds));
}
void WindowTreeHost::ConvertPointToNativeScreen(gfx::Point* point) const {
« no previous file with comments | « ui/aura/BUILD.gn ('k') | ui/aura/window_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698