| Index: ash/wm/workspace/workspace_window_resizer.cc
|
| diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc
|
| index 25430933827c63762fb0e9b7dcc1cc1d348f5370..7714cdd25af1abc5571b10a03495ab3ffdf46f1f 100644
|
| --- a/ash/wm/workspace/workspace_window_resizer.cc
|
| +++ b/ash/wm/workspace/workspace_window_resizer.cc
|
| @@ -23,6 +23,7 @@
|
| #include "ash/wm/window_util.h"
|
| #include "ash/wm/workspace/phantom_window_controller.h"
|
| #include "ash/wm/workspace/snap_sizer.h"
|
| +#include "ash/wm/workspace/stuck_edge_types.h"
|
| #include "base/command_line.h"
|
| #include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/client/window_types.h"
|
| @@ -368,7 +369,7 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) {
|
| if (!did_move_or_resize_ || details_.window_component != HTCAPTION)
|
| return;
|
|
|
| - // When the window is not in the normal show state, we do not snap thw window.
|
| + // When the window is not in the normal show state, we do not snap the window.
|
| // This happens when the user minimizes or maximizes the window by keyboard
|
| // shortcut while dragging it. If the window is the result of dragging a tab
|
| // out of a maximized window, it's already in the normal show state when this
|
| @@ -384,7 +385,19 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) {
|
| initial_bounds :
|
| details_.restore_bounds);
|
| }
|
| - window()->SetBounds(snap_sizer_->target_bounds());
|
| + gfx::Rect bounds = snap_sizer_->target_bounds();
|
| + window()->SetBounds(bounds);
|
| +
|
| + gfx::Rect bounds_in_parent = ScreenAsh::ConvertRectToScreen(
|
| + window()->parent(),
|
| + ScreenAsh::GetMaximizedWindowBoundsInParent(window()));
|
| + int stuck_edges_mask =
|
| + internal::WorkspaceWindowResizer::CalculateStuckEdges(
|
| + bounds, bounds_in_parent);
|
| + if (GetStuckToEdge(window()) != stuck_edges_mask &&
|
| + CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kAshEnableDockedWindows))
|
| + SetStuckToEdge(window(), stuck_edges_mask);
|
| return;
|
| }
|
| }
|
| @@ -725,6 +738,11 @@ void WorkspaceWindowResizer::StickToWorkAreaOnMove(
|
| // between snapping to top then bottom.
|
| bounds->set_y(bottom_edge - bounds->height());
|
| }
|
| + int stuck_edges_mask = CalculateStuckEdges(*bounds, work_area);
|
| + if (GetStuckToEdge(window()) != stuck_edges_mask &&
|
| + CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kAshEnableDockedWindows))
|
| + SetStuckToEdge(window(), stuck_edges_mask);
|
| }
|
|
|
| void WorkspaceWindowResizer::StickToWorkAreaOnResize(
|
| @@ -756,6 +774,21 @@ void WorkspaceWindowResizer::StickToWorkAreaOnResize(
|
| }
|
| }
|
|
|
| +int WorkspaceWindowResizer::CalculateStuckEdges(
|
| + const gfx::Rect& bounds,
|
| + const gfx::Rect& work_area) {
|
| + int stuck_edges_mask = STUCK_EDGE_NONE;
|
| + if (bounds.x() == work_area.x())
|
| + stuck_edges_mask |= STUCK_EDGE_LEFT;
|
| + if (bounds.right() == work_area.right())
|
| + stuck_edges_mask |= STUCK_EDGE_RIGHT;
|
| + if (bounds.y() == work_area.y())
|
| + stuck_edges_mask |= STUCK_EDGE_TOP;
|
| + if (bounds.bottom() == work_area.bottom())
|
| + stuck_edges_mask |= STUCK_EDGE_BOTTOM;
|
| + return stuck_edges_mask;
|
| +}
|
| +
|
| int WorkspaceWindowResizer::PrimaryAxisSize(const gfx::Size& size) const {
|
| return PrimaryAxisCoordinate(size.width(), size.height());
|
| }
|
|
|