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

Unified Diff: ash/wm/dock/docked_window_layout_manager.cc

Issue 68033003: Undocks window first before side-snapping bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undocks window first before side-snapping bounds (rebase) Created 7 years, 1 month 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
Index: ash/wm/dock/docked_window_layout_manager.cc
diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc
index f4a2e2629b8225e442dd4d20bfe8a30714acf783..41b5cb55e369ebcfdbb31e665cf66ed22a30bec5 100644
--- a/ash/wm/dock/docked_window_layout_manager.cc
+++ b/ash/wm/dock/docked_window_layout_manager.cc
@@ -101,6 +101,15 @@ void UndockWindow(aura::Window* window) {
aura::client::ParentWindowWithContext(window, window, gfx::Rect());
if (window->parent() != previous_parent)
wm::ReparentTransientChildrenOfChild(window->parent(), window);
+ wm::WindowState* window_state = wm::GetWindowState(window);
+ if (window_state->window_show_type() == wm::SHOW_TYPE_LEFT_SNAPPED ||
+ window_state->window_show_type() == wm::SHOW_TYPE_RIGHT_SNAPPED) {
+ // Windows that are right- or left-snapped out of the dock are have their
+ // bounds already set and the animation started when the undocking happens.
+ // There is no need to reset the layer bounds since correct original bounds
+ // were used for animation.
+ return;
+ }
// Start maximize or fullscreen (affecting packaged apps) animation from
// previous window bounds.
window->layer()->SetBounds(previous_bounds);
@@ -565,11 +574,13 @@ void DockedWindowLayoutManager::OnWindowShowTypeChanged(
return;
if (window_state->IsMinimized()) {
MinimizeDockedWindow(window_state);
- } else if (window_state->IsMaximizedOrFullscreen()) {
- // Reparenting changes the source bounds for the animation if a window is
- // visible so hide it here and show later when it is already in the desktop.
- UndockWindow(window);
- RecordUmaAction(DOCKED_ACTION_MAXIMIZE, DOCKED_ACTION_SOURCE_UNKNOWN);
+ } else if (window_state->IsMaximizedOrFullscreen() ||
+ window_state->window_show_type() == wm::SHOW_TYPE_LEFT_SNAPPED ||
+ window_state->window_show_type() == wm::SHOW_TYPE_RIGHT_SNAPPED) {
+ if (window != dragged_window_) {
+ UndockWindow(window);
+ RecordUmaAction(DOCKED_ACTION_MAXIMIZE, DOCKED_ACTION_SOURCE_UNKNOWN);
+ }
} else if (old_type == wm::SHOW_TYPE_MINIMIZED) {
RestoreDockedWindow(window_state);
}

Powered by Google App Engine
This is Rietveld 408576698