diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-30 22:49:17 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-30 22:49:17 +0000 |
commit | d96dd2c384b32e76c42c4173cbbb0397d0000222 (patch) | |
tree | 91c785452d1f6de65cda7d42ff5a493be8f831d1 /ui/aura/test | |
parent | e2dd8727406f9bf6c8c79b66f0199c8386958f4c (diff) | |
download | chromium_src-d96dd2c384b32e76c42c4173cbbb0397d0000222.zip chromium_src-d96dd2c384b32e76c42c4173cbbb0397d0000222.tar.gz chromium_src-d96dd2c384b32e76c42c4173cbbb0397d0000222.tar.bz2 |
Fix a bug where in the shell the modal window was being visually stacked below the launcher after showing and hiding the non-modal transient.
BUG=none
TEST=open window type launcher, show and then hide a window using the show/hide button, then open a window-modal window. the window modal window would appear rendered behind the type launcher, but if you clicked on where it would have been you can actually move it out from under. this bug makes sure it is always stacked on top visually also.
Review URL: https://chromiumcodereview.appspot.com/9298038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119753 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/test')
-rw-r--r-- | ui/aura/test/test_windows.cc | 30 | ||||
-rw-r--r-- | ui/aura/test/test_windows.h | 10 |
2 files changed, 40 insertions, 0 deletions
diff --git a/ui/aura/test/test_windows.cc b/ui/aura/test/test_windows.cc index 1c8a540..14fd638 100644 --- a/ui/aura/test/test_windows.cc +++ b/ui/aura/test/test_windows.cc @@ -54,5 +54,35 @@ Window* CreateTestWindowWithDelegateAndType(WindowDelegate* delegate, return window; } +Window* CreateTransientChild(int id, Window* parent) { + Window* window = new Window(NULL); + window->set_id(id); + window->SetType(aura::client::WINDOW_TYPE_NORMAL); + window->Init(ui::Layer::LAYER_TEXTURED); + window->SetParent(NULL); + parent->AddTransientChild(window); + return window; +} + +template <typename T> +bool ObjectIsAbove(T* upper, T* lower) { + DCHECK_EQ(upper->parent(), lower->parent()); + DCHECK_NE(upper, lower); + const std::vector<T*>& children = upper->parent()->children(); + const size_t upper_i = + std::find(children.begin(), children.end(), upper) - children.begin(); + const size_t lower_i = + std::find(children.begin(), children.end(), lower) - children.begin(); + return upper_i > lower_i; +} + +bool WindowIsAbove(Window* upper, Window* lower) { + return ObjectIsAbove<Window>(upper, lower); +} + +bool LayerIsAbove(Window* upper, Window* lower) { + return ObjectIsAbove<ui::Layer>(upper->layer(), lower->layer()); +} + } // namespace test } // namespace aura diff --git a/ui/aura/test/test_windows.h b/ui/aura/test/test_windows.h index 1781104..d0b782d 100644 --- a/ui/aura/test/test_windows.h +++ b/ui/aura/test/test_windows.h @@ -31,6 +31,16 @@ Window* CreateTestWindowWithDelegateAndType(WindowDelegate* delegate, const gfx::Rect& bounds, Window* parent); +// Creates a transient child window of |parent|. +Window* CreateTransientChild(int id, Window* parent); + +// Returns true if |upper| is above |lower| in the window stacking order. +bool WindowIsAbove(Window* upper, Window* lower); + +// Returns true if |upper|'s layer is above |lower|'s layer in the layer +// stacking order. +bool LayerIsAbove(Window* upper, Window* lower); + } // namespace test } // namespace aura |