Commit 83a89fd4 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: Fix issues with minimized windows in overview.

The minimized windows are now stacked underneath non-minimized windows.
Minimized windows now animate back when uncessfully swipe to close.

Test: manual
Bug: 886392, 886390
Change-Id: I520a9cfc642e5f417af6755b783b831098430ce8
Reviewed-on: https://chromium-review.googlesource.com/1238782
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593590}
parent b47080fe
......@@ -526,6 +526,10 @@ void ScopedTransformOverviewWindow::CreateMirrorWindowForMinimizedState() {
minimized_widget_->SetBounds(bounds);
minimized_widget_->Show();
// Stack the minimized window at the bottom since it is never transformed in
// and only faded in, so it should always be underneath non minimized windows.
window_->parent()->StackChildAtBottom(minimized_widget_->GetNativeWindow());
FadeInWidgetAndMaybeSlideOnEnter(
minimized_widget_.get(), OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN,
/*slide=*/false);
......
......@@ -633,8 +633,14 @@ void WindowSelectorItem::SetBounds(const gfx::Rect& target_bounds,
gfx::Rect inset_bounds(target_bounds);
inset_bounds.Inset(kWindowMargin, kWindowMargin);
if (wm::GetWindowState(GetWindow())->IsMinimized())
// Do not animate if entering when the window is minimized, as it will be
// faded in. We still want to animate if the position is changed after
// entering.
if (wm::GetWindowState(GetWindow())->IsMinimized() &&
mode == HeaderFadeInMode::kFirstUpdate) {
new_animation_type = OVERVIEW_ANIMATION_NONE;
}
SetItemBounds(inset_bounds, new_animation_type);
......
......@@ -2612,13 +2612,14 @@ TEST_F(WindowSelectorTest, OverviewWidgetStackingOrder) {
// The original order of stacking is determined by the order the associated
// window was activated (created in this case). All widgets associated with
// minimized windows will be above non minimized windows, because a widget for
// the minimized windows is created upon entering overview, and them the
// window selector item widget is stacked on top of that.
EXPECT_GT(IndexOf(widget2->GetNativeWindow(), parent),
IndexOf(widget3->GetNativeWindow(), parent));
// minimized windows will be below non minimized windows, because a widget for
// the minimized windows is created upon entering overview, and they are
// explicitly stacked beneath non minimized windows so they do not cover them
// during enter animation.
EXPECT_GT(IndexOf(widget3->GetNativeWindow(), parent),
IndexOf(widget1->GetNativeWindow(), parent));
EXPECT_GT(IndexOf(widget1->GetNativeWindow(), parent),
IndexOf(widget2->GetNativeWindow(), parent));
// Verify that only minimized windows have minimized widgets in overview.
EXPECT_FALSE(min_widget1);
......@@ -2660,10 +2661,10 @@ TEST_F(WindowSelectorTest, OverviewWidgetStackingOrder) {
generator->ReleaseLeftButton();
// Verify the stacking order is same as before dragging started.
EXPECT_GT(IndexOf(widget2->GetNativeWindow(), parent),
IndexOf(widget3->GetNativeWindow(), parent));
EXPECT_GT(IndexOf(widget3->GetNativeWindow(), parent),
IndexOf(widget1->GetNativeWindow(), parent));
EXPECT_GT(IndexOf(widget1->GetNativeWindow(), parent),
IndexOf(widget2->GetNativeWindow(), parent));
}
// Tests that overview widgets are stacked in the correct order.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment