summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/wm/workspace/workspace_layout_manager.cc18
-rw-r--r--ash/wm/workspace/workspace_manager_unittest.cc5
2 files changed, 7 insertions, 16 deletions
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index d9995d8c..a705059 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -85,6 +85,7 @@ void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
SetChildBoundsDirect(child,
gfx::Screen::GetMonitorAreaNearestWindow(child));
} else {
+ // Align non-maximized/fullscreen windows to a grid.
SetChildBoundsDirect(
child, workspace_manager_->AlignBoundsToGrid(child->GetTargetBounds()));
}
@@ -110,17 +111,12 @@ void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(
void WorkspaceLayoutManager::SetChildBounds(
aura::Window* child,
const gfx::Rect& requested_bounds) {
- if (child == workspace_manager_->ignored_window() ||
- !workspace_manager_->IsManagedWindow(child)) {
- // Allow requests for |ignored_window_| or unmanaged windows.
- SetChildBoundsDirect(child, requested_bounds);
- } else if (!window_util::IsWindowMaximized(child) &&
- !window_util::IsWindowFullscreen(child)) {
- // Align normal windows to the grid.
- SetChildBoundsDirect(
- child, workspace_manager_->AlignBoundsToGrid(requested_bounds));
- }
- // All other requests we ignore.
+ gfx::Rect child_bounds(requested_bounds);
+ if (window_util::IsWindowMaximized(child))
+ child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child);
+ else if (window_util::IsWindowFullscreen(child))
+ child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child);
+ SetChildBoundsDirect(child, child_bounds);
}
} // namespace internal
diff --git a/ash/wm/workspace/workspace_manager_unittest.cc b/ash/wm/workspace/workspace_manager_unittest.cc
index a7ba3be..90db9b0 100644
--- a/ash/wm/workspace/workspace_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_manager_unittest.cc
@@ -355,11 +355,6 @@ TEST_F(WorkspaceManagerTest, SnapToGrid) {
w1->SetBounds(gfx::Rect(1, 6, 25, 30));
w1->SetParent(viewport());
EXPECT_EQ(gfx::Rect(0, 8, 24, 32), w1->bounds());
-
- // Verify snap to grid when bounds are set after parented.
- w1.reset(CreateTestWindow());
- w1->SetBounds(gfx::Rect(1, 6, 25, 30));
- EXPECT_EQ(gfx::Rect(0, 8, 24, 32), w1->bounds());
}
// Assertions around a fullscreen window.