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

Unified Diff: ash/wm/window_resizer.cc

Issue 57963003: Enforces 10px visibility when dragging between displays (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enforces 10px visibility when dragging between displays Created 7 years, 1 month 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 | « ash/wm/drag_window_resizer_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_resizer.cc
diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc
index 65b390aaa9e3ac0328bf64f49e556c2c7f3da653..372ce4889e0539af5ebadc8bc8f88144a9ba7014 100644
--- a/ash/wm/window_resizer.cc
+++ b/ash/wm/window_resizer.cc
@@ -263,12 +263,15 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag(
// the |work_area| above isn't good for this check since it is the work area
// for the current display but the window can move to a different one.
aura::Window* parent = details.window->parent();
- gfx::Rect new_bounds_in_screen =
- ScreenAsh::ConvertRectToScreen(parent, new_bounds);
+ gfx::Point passed_location_in_screen(passed_location);
+ wm::ConvertPointToScreen(parent, &passed_location_in_screen);
+ gfx::Rect near_passed_location(passed_location_in_screen, gfx::Size());
+ // Use a pointer location (matching the logic in DragWindowResizer) to
+ // calculate the target display after the drag.
const gfx::Display& display =
- Shell::GetScreen()->GetDisplayMatching(new_bounds_in_screen);
+ Shell::GetScreen()->GetDisplayMatching(near_passed_location);
aura::Window* dock_container = Shell::GetContainer(
- wm::GetRootWindowMatching(new_bounds_in_screen),
+ wm::GetRootWindowMatching(near_passed_location),
internal::kShellWindowId_DockedContainer);
internal::DockedWindowLayoutManager* dock_layout =
static_cast<internal::DockedWindowLayoutManager*>(
@@ -277,6 +280,8 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag(
gfx::Rect screen_work_area = display.work_area();
screen_work_area.Union(dock_layout->docked_bounds());
screen_work_area.Inset(kMinimumOnScreenArea, 0);
+ gfx::Rect new_bounds_in_screen =
+ ScreenAsh::ConvertRectToScreen(parent, new_bounds);
if (!screen_work_area.Intersects(new_bounds_in_screen)) {
// Make sure that the x origin does not leave the current display.
new_bounds_in_screen.set_x(
« no previous file with comments | « ash/wm/drag_window_resizer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698