From 2faf2ce776c4094e0e4b3d456ff7b4eb44bb58bf Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Wed, 15 Feb 2012 01:40:44 +0000 Subject: Change WorkspaceLayoutManager::SetChildBounds to pass through any size. Looks like we're not going to do the full managed window manager, so this code doesn't make sense. BUG=none TEST=none R=oshima@chromium.org Review URL: http://codereview.chromium.org/9387021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121997 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/wm/workspace/workspace_layout_manager.cc | 18 +++++++----------- ash/wm/workspace/workspace_manager_unittest.cc | 5 ----- 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. -- cgit v1.1