Chromium Code Reviews| Index: ash/wm/workspace/workspace_layout_manager.cc |
| diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc |
| index 1f8847a72e6b689be9d61ef22eb917acd39f2043..5f260a45a4b5b385730a20822298788e75f8b41a 100644 |
| --- a/ash/wm/workspace/workspace_layout_manager.cc |
| +++ b/ash/wm/workspace/workspace_layout_manager.cc |
| @@ -116,22 +116,14 @@ void WorkspaceLayoutManager::SetShelf(internal::ShelfLayoutManager* shelf) { |
| // WorkspaceLayoutManager, aura::LayoutManager implementation: |
| void WorkspaceLayoutManager::OnWindowAddedToLayout(Window* child) { |
| - AdjustWindowBoundsWhenAdded(wm::GetWindowState(child)); |
| + wm::WindowState* window_state = wm::GetWindowState(child); |
| + AdjustWindowBoundsWhenAdded(window_state); |
| windows_.insert(child); |
| child->AddObserver(this); |
| - wm::WindowState* window_state = wm::GetWindowState(child); |
| window_state->AddObserver(this); |
|
pkotwicz
2014/02/13 00:32:39
Isn't the logic below redundant and already perfor
oshima
2014/02/13 01:10:13
Good point. Looks like we've been doing this twice
|
| - |
| - // Only update the bounds if the window has a show state that depends on the |
| - // workspace area. |
| - if (window_state->IsMaximized()) { |
| - SetChildBoundsDirect( |
| - child, ScreenUtil::GetMaximizedWindowBoundsInParent(child)); |
| - } else if (window_state->IsFullscreen()) { |
| - SetChildBoundsDirect( |
| - child, ScreenUtil::GetDisplayBoundsInParent(child)); |
| - } |
| + if (!window_state->is_dragged()) |
| + SetMaximizedOrFullscreenBounds(window_state); |
| UpdateShelfVisibility(); |
| UpdateFullscreenState(); |
| @@ -175,6 +167,10 @@ void WorkspaceLayoutManager::SetChildBounds( |
| wm::WindowState* window_state = wm::GetWindowState(child); |
| if (window_state->is_dragged()) { |
| SetChildBoundsDirect(child, requested_bounds); |
| + } else if (window_state->IsSnapped()) { |
|
pkotwicz
2014/02/13 00:32:39
This allows a snapped window to be as wide as it w
oshima
2014/02/13 01:10:13
Fixed. I think the same thing can happen during dr
|
| + gfx::Rect child_bounds(requested_bounds); |
| + AdjustSnappedBounds(window_state, &child_bounds); |
| + SetChildBoundsDirect(child, child_bounds); |
| } else if (!SetMaximizedOrFullscreenBounds(window_state)) { |
| // Some windows rely on this to set their initial bounds. |
| // Non-maximized/full-screen windows have their size constrained to the |
| @@ -184,7 +180,6 @@ void WorkspaceLayoutManager::SetChildBounds( |
| child_bounds.width())); |
| child_bounds.set_height(std::min(work_area_in_parent_.height(), |
| child_bounds.height())); |
| - AdjustSnappedBounds(window_state, &child_bounds); |
| SetChildBoundsDirect(child, child_bounds); |
| } |
| UpdateShelfVisibility(); |