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

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

Issue 477823003: Clear restore bounds for user resize/drag actions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 4 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/workspace_layout_manager.cc ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_window_resizer.cc
diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc
index 395c2adbdc80f2f0e4ecd5dfad0bdf0f66077044..76110718830e13526172027e9bdcdeebcb6b36aa 100644
--- a/ash/wm/workspace/workspace_window_resizer.cc
+++ b/ash/wm/workspace/workspace_window_resizer.cc
@@ -443,23 +443,31 @@ void WorkspaceWindowResizer::CompleteDrag() {
}
}
- if (!snapped && window_state()->IsSnapped()) {
- // Keep the window snapped if the user resizes the window such that the
- // window has valid bounds for a snapped window. Always unsnap the window
- // if the user dragged the window via the caption area because doing this is
- // slightly less confusing.
- if (details().window_component == HTCAPTION ||
- !AreBoundsValidSnappedBounds(window_state()->GetStateType(),
- GetTarget()->bounds())) {
- // Set the window to WINDOW_STATE_TYPE_NORMAL but keep the
- // window at the bounds that the user has moved/resized the
- // window to. ClearRestoreBounds() is used instead of
- // SaveCurrentBoundsForRestore() because most of the restore
- // logic is skipped because we are still in the middle of a
- // drag. TODO(pkotwicz): Fix this and use
- // SaveCurrentBoundsForRestore().
+ if (!snapped) {
+ if (window_state()->IsSnapped()) {
+ // Keep the window snapped if the user resizes the window such that the
+ // window has valid bounds for a snapped window. Always unsnap the window
+ // if the user dragged the window via the caption area because doing this
+ // is slightly less confusing.
+ if (details().window_component == HTCAPTION ||
+ !AreBoundsValidSnappedBounds(window_state()->GetStateType(),
+ GetTarget()->bounds())) {
+ // Set the window to WINDOW_STATE_TYPE_NORMAL but keep the
+ // window at the bounds that the user has moved/resized the
+ // window to. ClearRestoreBounds() is used instead of
+ // SaveCurrentBoundsForRestore() because most of the restore
+ // logic is skipped because we are still in the middle of a
+ // drag. TODO(pkotwicz): Fix this and use
+ // SaveCurrentBoundsForRestore().
+ window_state()->ClearRestoreBounds();
+ window_state()->Restore();
+ }
+ } else if (!dock_layout_->is_dragged_window_docked()) {
+ // The window was not snapped and is not snapped. This is a user
+ // resize/drag and so the current bounds should be maintained, clearing
+ // any prior restore bounds. When the window is docked the restore bound
+ // must be kept so the docked state can be reverted properly.
window_state()->ClearRestoreBounds();
- window_state()->Restore();
}
}
}
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.cc ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698