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

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

Issue 2739113002: Simplify calls for scale factor (Closed)
Patch Set: nit Created 3 years, 9 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/views/drag_utils.cc ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
index dd0c1947c461fe81bd513cb972b2b63a9cacc6ec..a1118cfeb31a6487a4db94f0ef1e7ced2bd7e617 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
@@ -24,6 +24,7 @@
#include "ui/base/dragdrop/drop_target_event.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h"
+#include "ui/base/layout.h"
#include "ui/base/x/selection_utils.h"
#include "ui/base/x/x11_util.h"
#include "ui/base/x/x11_window_event_manager.h"
@@ -893,11 +894,10 @@ void DesktopDragDropClientAuraX11::OnMouseMovement(
int flags,
base::TimeTicks event_time) {
if (drag_widget_.get()) {
- display::Display display =
- display::Screen::GetScreen()->GetDisplayNearestWindow(
- drag_widget_->GetNativeWindow());
- gfx::Point scaled_point = gfx::ScaleToRoundedPoint(
- screen_point, 1.f / display.device_scale_factor());
+ float scale_factor =
+ ui::GetScaleFactorForNativeView(drag_widget_->GetNativeWindow());
+ gfx::Point scaled_point =
+ gfx::ScaleToRoundedPoint(screen_point, 1.f / scale_factor);
drag_widget_->SetBounds(
gfx::Rect(scaled_point - drag_widget_offset_, drag_image_size_));
drag_widget_->StackAtTop();
« no previous file with comments | « ui/views/drag_utils.cc ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698