Commit 9f9def40 authored by sky@chromium.org's avatar sky@chromium.org

Makes sure switching workspaces only animations windows that want to

be shown.

BUG=116337
TEST=covered by tests
R=ben@chromium.org


Review URL: http://codereview.chromium.org/9557005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124360 0039d316-1c4b-4281-b951-d872f2087c98
parent 7fadd91a
......@@ -280,7 +280,8 @@ void WorkspaceManager::SetWindowLayerVisibility(
bool value) {
for (size_t i = 0; i < windows.size(); ++i) {
ui::Layer* layer = windows[i]->layer();
if (layer) {
// Only show the layer for windows that want to be visible.
if (layer && (!value || windows[i]->TargetVisibility())) {
windows[i]->SetProperty(aura::client::kAnimationsDisabledKey,
change_type == DONT_ANIMATE);
bool update_layer = true;
......
......@@ -396,5 +396,30 @@ TEST_F(WorkspaceManagerTest, SingleFullscreenWindow) {
EXPECT_EQ(gfx::Rect(0, 0, 250, 251), *GetRestoreBounds(w1.get()));
}
// Makes sure switching workspaces doesn't show transient windows.
TEST_F(WorkspaceManagerTest, DontShowTransientsOnSwitch) {
scoped_ptr<Window> w1(CreateTestWindow());
scoped_ptr<Window> w2(CreateTestWindow());
w1->SetBounds(gfx::Rect(0, 0, 250, 251));
w2->SetBounds(gfx::Rect(0, 0, 250, 251));
w1->AddTransientChild(w2.get());
w1->Show();
scoped_ptr<Window> w3(CreateTestWindow());
w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w3->Show();
EXPECT_FALSE(w1->layer()->IsDrawn());
EXPECT_FALSE(w2->layer()->IsDrawn());
EXPECT_TRUE(w3->layer()->IsDrawn());
w1->Show();
EXPECT_TRUE(w1->layer()->IsDrawn());
EXPECT_FALSE(w2->layer()->IsDrawn());
EXPECT_FALSE(w3->layer()->IsDrawn());
}
} // namespace internal
} // namespace ash
......@@ -123,6 +123,10 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
void Hide();
// Returns true if this window and all its ancestors are visible.
bool IsVisible() const;
// Returns the visibility requested by this window. IsVisible() takes into
// account the visibility of the layer and ancestors, where as this tracks
// whether Show() without a Hide() has been invoked.
bool TargetVisibility() const { return visible_; }
// Returns the window's bounds in screen coordinates.
gfx::Rect GetScreenBounds() const;
......
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