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

Unified Diff: ui/wm/core/default_screen_position_client.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: Fixed Other Unit Tests - Moved Inner Classes Outside Created 4 years, 11 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
« ui/gfx/display.h ('K') | « ui/views/win/hwnd_message_handler_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/default_screen_position_client.cc
diff --git a/ui/wm/core/default_screen_position_client.cc b/ui/wm/core/default_screen_position_client.cc
index d26a91ed9c8f92c66495eab9cfc7de7e5a749d87..13021a3175611f1a72a18b4ee50573fbb4c3d59d 100644
--- a/ui/wm/core/default_screen_position_client.cc
+++ b/ui/wm/core/default_screen_position_client.cc
@@ -7,6 +7,7 @@
#include "ui/aura/window_tree_host.h"
#include "ui/gfx/display.h"
#include "ui/gfx/geometry/point_conversions.h"
+#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/screen.h"
namespace wm {
@@ -19,11 +20,11 @@ DefaultScreenPositionClient::~DefaultScreenPositionClient() {
gfx::Point DefaultScreenPositionClient::GetOriginInScreen(
const aura::Window* root_window) {
- gfx::Point origin_in_pixels = root_window->GetHost()->GetBounds().origin();
aura::Window* window = const_cast<aura::Window*>(root_window);
- float scale = gfx::Screen::GetScreenFor(window)->
- GetDisplayNearestWindow(window).device_scale_factor();
- return gfx::ScaleToFlooredPoint(origin_in_pixels, 1.0f / scale);
+ gfx::Screen* screen = gfx::Screen::GetScreenFor(window);
+ gfx::Rect screen_bounds = root_window->GetHost()->GetBounds();
+ gfx::Rect dip_bounds = screen->ScreenToDIPRectInWindow(window, screen_bounds);
oshima 2016/01/21 17:47:44 is this screen_bounds in native screen coordinates
robliao 2016/01/21 18:19:20 We really need that units refactor. GetOriginInSc
+ return dip_bounds.origin();
}
void DefaultScreenPositionClient::ConvertPointToScreen(
« ui/gfx/display.h ('K') | « ui/views/win/hwnd_message_handler_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698