Commit b40cafcd authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Commit Bot

Do not update a minimized window bounds until it's unminimized in tablet mode.

Bug: 801294
Change-Id: Icbc57aa6a570f8fe897a1956d6eab7b4661da173
Reviewed-on: https://chromium-review.googlesource.com/956604Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543628}
parent 63642262
......@@ -1746,4 +1746,30 @@ TEST_F(TabletModeWindowManagerTest, NoWindowResizerInTabletMode) {
EXPECT_FALSE(resizer.get());
}
// Test that the minimized window bounds doesn't change until it's unminimized.
TEST_F(TabletModeWindowManagerTest, DontChangeBoundsForMinimizedWindow) {
gfx::Rect rect(10, 10, 200, 50);
std::unique_ptr<aura::Window> window(
CreateWindow(aura::client::WINDOW_TYPE_NORMAL, rect));
wm::WindowState* window_state = wm::GetWindowState(window.get());
window_state->Minimize();
EXPECT_TRUE(window_state->IsMinimized());
TabletModeWindowManager* manager = CreateTabletModeWindowManager();
ASSERT_TRUE(manager);
EXPECT_EQ(1, manager->GetNumberOfManagedWindows());
EXPECT_TRUE(window_state->IsMinimized());
EXPECT_EQ(window->bounds(), rect);
WindowSelectorController* window_selector_controller =
Shell::Get()->window_selector_controller();
window_selector_controller->ToggleOverview();
EXPECT_EQ(window->bounds(), rect);
// Exit overview mode will update all windows' bounds. However, if the window
// is minimized, the bounds will not be updated.
window_selector_controller->ToggleOverview();
EXPECT_EQ(window->bounds(), rect);
}
} // namespace ash
......@@ -381,13 +381,17 @@ void TabletModeWindowState::UpdateBounds(wm::WindowState* window_state,
bool animated) {
if (defer_bounds_updates_)
return;
// Do not update minimized windows bounds until it was unminimized.
if (current_state_type_ == mojom::WindowStateType::MINIMIZED)
return;
gfx::Rect bounds_in_parent = GetBoundsInMaximizedMode(window_state);
// If we have a target bounds rectangle, we center it and set it
// accordingly.
if (!bounds_in_parent.IsEmpty() &&
bounds_in_parent != window_state->window()->bounds()) {
if (current_state_type_ == mojom::WindowStateType::MINIMIZED ||
!window_state->window()->IsVisible() || !animated) {
if (!window_state->window()->IsVisible() || !animated) {
window_state->SetBoundsDirect(bounds_in_parent);
} else {
// If we animate (to) tablet mode, we want to use the cross fade to
......
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