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

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 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();
« 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