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

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: 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
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..0e9665d2d456a750c041f7f57953b43e682b42be 100644
--- a/ui/views/corewm/focus_controller.cc
+++ b/ui/views/corewm/focus_controller.cc
@@ -31,6 +31,21 @@ 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;
+ }
+ window->layer()->parent()->StackAbove(window->layer(), relative_to->layer());
+}
+
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -200,10 +215,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);
}
}
« ash/wm/workspace/workspace_manager_unittest.cc ('K') | « 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