diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-31 20:33:47 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-31 20:33:47 +0000 |
commit | 33340706fa69996dccad58e93214be0996a7cfba (patch) | |
tree | 1c305cfbfce512bc5444df0ea9a1bbe5b142c7a5 /ui | |
parent | 6328bea86571399d38c86e21e941632abb17843d (diff) | |
download | chromium_src-33340706fa69996dccad58e93214be0996a7cfba.zip chromium_src-33340706fa69996dccad58e93214be0996a7cfba.tar.gz chromium_src-33340706fa69996dccad58e93214be0996a7cfba.tar.bz2 |
Makes DefaultContainerLayoutManager ignore windows with transient
parents. This is needed otherwise the worskpace code tries to place
and position bubbles and other transient type windows.
BUG=none
TEST=none
R=ben@chromium.org,oshima@chromium.org
Review URL: http://codereview.chromium.org/8414035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/window.h | 5 | ||||
-rw-r--r-- | ui/aura_shell/default_container_layout_manager.cc | 5 | ||||
-rw-r--r-- | ui/aura_shell/default_container_layout_manager_unittest.cc | 21 |
3 files changed, 28 insertions, 3 deletions
diff --git a/ui/aura/window.h b/ui/aura/window.h index 2554716..8a9b030 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -182,6 +182,11 @@ class AURA_EXPORT Window : public ui::LayerDelegate { void AddTransientChild(Window* child); void RemoveTransientChild(Window* child); + const Windows& transient_children() const { return transient_children_; } + + Window* transient_parent() { return transient_parent_; } + const Window* transient_parent() const { return transient_parent_; } + // Retrieves the first-level child with the specified id, or NULL if no first- // level child is found matching |id|. Window* GetChildById(int id); diff --git a/ui/aura_shell/default_container_layout_manager.cc b/ui/aura_shell/default_container_layout_manager.cc index 98d3dc3..5fd34bd 100644 --- a/ui/aura_shell/default_container_layout_manager.cc +++ b/ui/aura_shell/default_container_layout_manager.cc @@ -102,7 +102,8 @@ void DefaultContainerLayoutManager::OnWindowResized() { void DefaultContainerLayoutManager::OnWindowAdded(aura::Window* child) { intptr_t type = reinterpret_cast<intptr_t>( ui::ViewProp::GetValue(child, views::NativeWidgetAura::kWindowTypeKey)); - if (type != views::Widget::InitParams::TYPE_WINDOW) + if (type != views::Widget::InitParams::TYPE_WINDOW || + child->transient_parent()) return; AutoReset<bool> reset(&ignore_calculate_bounds_, true); @@ -144,7 +145,7 @@ void DefaultContainerLayoutManager::CalculateBoundsForChild( intptr_t type = reinterpret_cast<intptr_t>( ui::ViewProp::GetValue(child, views::NativeWidgetAura::kWindowTypeKey)); if (type != views::Widget::InitParams::TYPE_WINDOW || - ignore_calculate_bounds_) + ignore_calculate_bounds_ || child->transient_parent()) return; // If a drag window is requesting bounds, make sure its attached to diff --git a/ui/aura_shell/default_container_layout_manager_unittest.cc b/ui/aura_shell/default_container_layout_manager_unittest.cc index deefc5a..d3dcd05 100644 --- a/ui/aura_shell/default_container_layout_manager_unittest.cc +++ b/ui/aura_shell/default_container_layout_manager_unittest.cc @@ -67,11 +67,12 @@ class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase { return workspace_controller_->layout_manager(); } - private: + protected: scoped_ptr<aura::Window> container_; ScopedVector<ui::ViewProp> props_; scoped_ptr<aura_shell::internal::WorkspaceController> workspace_controller_; + private: DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest); }; @@ -136,5 +137,23 @@ TEST_F(DefaultContainerLayoutManagerTest, Popup) { EXPECT_EQ("0,0 1000x1000", popup->bounds().ToString()); } +// Make sure a window with a transient parent isn't resized by the layout +// manager. +TEST_F(DefaultContainerLayoutManagerTest, IgnoreTransient) { + scoped_ptr<aura::Window> window(new aura::Window(NULL)); + props_.push_back( + new ui::ViewProp( + window.get(), views::NativeWidgetAura::kWindowTypeKey, + reinterpret_cast<void*>(Widget::InitParams::TYPE_WINDOW))); + window->SetType(Widget::InitParams::TYPE_WINDOW); + window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); + aura::Desktop::GetInstance()->AddTransientChild(window.get()); + window->SetBounds(gfx::Rect(0, 0, 200, 200)); + window->Show(); + window->SetParent(container()); + + EXPECT_EQ("0,0 200x200", window->bounds().ToString()); +} + } // namespace test } // namespace aura_shell |