Commit 5504c56e authored by xiyuan@chromium.org's avatar xiyuan@chromium.org

ash: Fix transient child in wrong workspace.

Persists-across-all-workspace flag should not cause workspace switch when
showing a transient child of a maximized transient parent.

BUG=232119
TEST=Covered in a new test.

Review URL: https://codereview.chromium.org/13867010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194603 0039d316-1c4b-4281-b951-d872f2087c98
parent fcb123d4
...@@ -78,15 +78,11 @@ bool Workspace::ShouldMoveToPending() const { ...@@ -78,15 +78,11 @@ bool Workspace::ShouldMoveToPending() const {
if (!child->TargetVisibility() || wm::IsWindowMinimized(child)) if (!child->TargetVisibility() || wm::IsWindowMinimized(child))
continue; continue;
if (!GetTrackedByWorkspace(child)) { // If we have a maximized window don't move to pending.
// If we have a maximized window that isn't tracked don't move to if (WorkspaceManager::IsMaximized(child))
// pending. This handles the case of dragging a maximized window. return false;
if (WorkspaceManager::IsMaximized(child))
return false;
continue;
}
if (!GetPersistsAcrossAllWorkspaces(child)) if (GetTrackedByWorkspace(child) && !GetPersistsAcrossAllWorkspaces(child))
return false; return false;
} }
return true; return true;
......
...@@ -452,6 +452,30 @@ TEST_F(WorkspaceManagerTest, DontShowTransientsOnSwitch) { ...@@ -452,6 +452,30 @@ TEST_F(WorkspaceManagerTest, DontShowTransientsOnSwitch) {
EXPECT_FALSE(w3->layer()->IsDrawn()); EXPECT_FALSE(w3->layer()->IsDrawn());
} }
// Persists-across-all-workspace flag should not cause a transient child
// to be activated at desktop workspace.
TEST_F(WorkspaceManagerTest, PersistsTransientChildStayInSameWorkspace) {
scoped_ptr<Window> w1(CreateTestWindow());
SetPersistsAcrossAllWorkspaces(
w1.get(),
WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w1->Show();
wm::ActivateWindow(w1.get());
ASSERT_EQ("0 M1 active=1", StateString());
scoped_ptr<Window> w2(CreateTestWindowUnparented());
w1->AddTransientChild(w2.get());
SetPersistsAcrossAllWorkspaces(
w2.get(),
WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
SetDefaultParentByPrimaryRootWindow(w2.get());
w2->Show();
wm::ActivateWindow(w2.get());
ASSERT_EQ("0 M2 active=1", StateString());
}
// Assertions around minimizing a single window. // Assertions around minimizing a single window.
TEST_F(WorkspaceManagerTest, MinimizeSingleWindow) { TEST_F(WorkspaceManagerTest, MinimizeSingleWindow) {
scoped_ptr<Window> w1(CreateTestWindow()); scoped_ptr<Window> w1(CreateTestWindow());
......
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