OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/dock/docked_window_layout_manager.h" | 5 #include "ash/wm/dock/docked_window_layout_manager.h" |
6 | 6 |
7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 }; | 203 }; |
204 | 204 |
205 namespace { | 205 namespace { |
206 | 206 |
207 // Returns true if a window is a popup or a transient child. | 207 // Returns true if a window is a popup or a transient child. |
208 bool IsPopupOrTransient(const aura::Window* window) { | 208 bool IsPopupOrTransient(const aura::Window* window) { |
209 return (window->type() == ui::wm::WINDOW_TYPE_POPUP || | 209 return (window->type() == ui::wm::WINDOW_TYPE_POPUP || |
210 ::wm::GetTransientParent(window)); | 210 ::wm::GetTransientParent(window)); |
211 } | 211 } |
212 | 212 |
213 // Certain windows (minimized, hidden or popups) do not matter to docking. | 213 // Certain windows (minimized, hidden or popups) do not matter to docking. |
oshima
2015/06/04 22:40:28
The comment and the function name aren't clear. Ca
varkha
2015/06/04 23:22:00
Done. This is mostly considered in this class for
| |
214 bool IsUsedByLayout(const aura::Window* window) { | 214 bool IsUsedByLayout(const aura::Window* window) { |
215 return (window->IsVisible() && | 215 return (window->IsVisible() && |
216 !wm::GetWindowState(window)->IsMinimized() && | 216 !wm::GetWindowState(window)->IsMinimized() && |
217 !IsPopupOrTransient(window)); | 217 !IsPopupOrTransient(window)); |
218 } | 218 } |
219 | 219 |
220 void UndockWindow(aura::Window* window) { | 220 void UndockWindow(aura::Window* window) { |
221 gfx::Rect previous_bounds = window->bounds(); | 221 gfx::Rect previous_bounds = window->bounds(); |
222 aura::Window* old_parent = window->parent(); | 222 aura::Window* old_parent = window->parent(); |
223 aura::client::ParentWindowWithContext(window, window, gfx::Rect()); | 223 aura::client::ParentWindowWithContext(window, window, gfx::Rect()); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
738 const gfx::Rect& requested_bounds) { | 738 const gfx::Rect& requested_bounds) { |
739 // The minimum constraints have to be applied first by the layout manager. | 739 // The minimum constraints have to be applied first by the layout manager. |
740 gfx::Rect actual_new_bounds(requested_bounds); | 740 gfx::Rect actual_new_bounds(requested_bounds); |
741 if (child->delegate()) { | 741 if (child->delegate()) { |
742 const gfx::Size& min_size = child->delegate()->GetMinimumSize(); | 742 const gfx::Size& min_size = child->delegate()->GetMinimumSize(); |
743 actual_new_bounds.set_width( | 743 actual_new_bounds.set_width( |
744 std::max(min_size.width(), actual_new_bounds.width())); | 744 std::max(min_size.width(), actual_new_bounds.width())); |
745 actual_new_bounds.set_height( | 745 actual_new_bounds.set_height( |
746 std::max(min_size.height(), actual_new_bounds.height())); | 746 std::max(min_size.height(), actual_new_bounds.height())); |
747 } | 747 } |
748 if (IsUsedByLayout(child) && child != dragged_window_) | |
oshima
2015/06/04 22:40:29
doesn't this prevent relayouting docked windows up
varkha
2015/06/04 23:22:00
No. Display change is handled in OnWindowResized()
| |
749 return; | |
748 SnapToPixelLayoutManager::SetChildBounds(child, actual_new_bounds); | 750 SnapToPixelLayoutManager::SetChildBounds(child, actual_new_bounds); |
749 if (IsPopupOrTransient(child)) | 751 if (IsPopupOrTransient(child)) |
750 return; | 752 return; |
751 // Whenever one of our windows is moved or resized enforce layout. | 753 // Whenever one of our windows is moved or resized enforce layout. |
752 ShelfLayoutManager* shelf_layout = | 754 ShelfLayoutManager* shelf_layout = |
753 ShelfLayoutManager::ForShelf(dock_container_); | 755 ShelfLayoutManager::ForShelf(dock_container_); |
754 if (shelf_layout) | 756 if (shelf_layout) |
755 shelf_layout->UpdateVisibilityState(); | 757 shelf_layout->UpdateVisibilityState(); |
756 } | 758 } |
757 | 759 |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1351 | 1353 |
1352 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1354 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
1353 const gfx::Rect& keyboard_bounds) { | 1355 const gfx::Rect& keyboard_bounds) { |
1354 // This bounds change will have caused a change to the Shelf which does not | 1356 // This bounds change will have caused a change to the Shelf which does not |
1355 // propagate automatically to this class, so manually recalculate bounds. | 1357 // propagate automatically to this class, so manually recalculate bounds. |
1356 Relayout(); | 1358 Relayout(); |
1357 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1359 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1358 } | 1360 } |
1359 | 1361 |
1360 } // namespace ash | 1362 } // namespace ash |
OLD | NEW |