Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 161293003: Add test case for updating the bounds of snapped window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/workspace/snap_sizer_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4e79c6e83d114f84213addf40e982c06bb4bbf6b..0a15a617389866041c9a4ec380b8bd97bb832e99 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -116,23 +116,12 @@ 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);
-
- // 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));
- }
-
UpdateShelfVisibility();
UpdateFullscreenState();
WindowPositioner::RearrangeVisibleWindowOnShow(child);
@@ -175,16 +164,17 @@ void WorkspaceLayoutManager::SetChildBounds(
wm::WindowState* window_state = wm::GetWindowState(child);
if (window_state->is_dragged()) {
SetChildBoundsDirect(child, requested_bounds);
+ } else if (window_state->IsSnapped()) {
+ gfx::Rect child_bounds(requested_bounds);
+ wm::AdjustBoundsSmallerThan(work_area_in_parent_.size(), &child_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
// work-area.
gfx::Rect child_bounds(requested_bounds);
- child_bounds.set_width(std::min(work_area_in_parent_.width(),
- child_bounds.width()));
- child_bounds.set_height(std::min(work_area_in_parent_.height(),
- child_bounds.height()));
- AdjustSnappedBounds(window_state, &child_bounds);
+ wm::AdjustBoundsSmallerThan(work_area_in_parent_.size(), &child_bounds);
SetChildBoundsDirect(child, child_bounds);
}
UpdateShelfVisibility();
« no previous file with comments | « ash/wm/workspace/snap_sizer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698