Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: ui/views/corewm/focus_controller.cc

Issue 13008024: Fixes bug where FocusController would stack a layer directly above a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't stack on top of same window Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/test/test_window_delegate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/focus_controller.cc
diff --git a/ui/views/corewm/focus_controller.cc b/ui/views/corewm/focus_controller.cc
index 4a893d89350d693f69096c21b421c1e149d2d0cc..52c076cd5c18ba22453e88869eb09de97bffa164 100644
--- a/ui/views/corewm/focus_controller.cc
+++ b/ui/views/corewm/focus_controller.cc
@@ -31,6 +31,24 @@ void StackTransientParentsBelowModalWindow(aura::Window* window) {
}
}
+// Stack's |window|'s layer above |relative_to|'s layer.
+void StackWindowLayerAbove(aura::Window* window, aura::Window* relative_to) {
+ // Stack |window| above the last transient child of |relative_to| that shares
+ // the same parent.
+ const aura::Window::Windows& window_transients(
+ relative_to->transient_children());
+ for (aura::Window::Windows::const_iterator i = window_transients.begin();
+ i != window_transients.end(); ++i) {
+ aura::Window* transient = *i;
+ if (transient->parent() == relative_to->parent())
+ relative_to = transient;
+ }
+ if (window != relative_to) {
+ window->layer()->parent()->StackAbove(window->layer(),
+ relative_to->layer());
+ }
+}
+
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -200,10 +218,8 @@ void FocusController::OnWindowVisibilityChanged(aura::Window* window,
// Despite the focus change, we need to keep the window being hidden
// stacked above the new window so it stays open on top as it animates away.
aura::Window* next_window = GetActiveWindow();
- if (next_window && next_window->parent() == window->parent()) {
- window->layer()->parent()->StackAbove(window->layer(),
- next_window->layer());
- }
+ if (next_window && next_window->parent() == window->parent())
+ StackWindowLayerAbove(window, next_window);
}
}
« no previous file with comments | « ui/aura/test/test_window_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698