Index: ui/aura/window.cc |
diff --git a/ui/aura/window.cc b/ui/aura/window.cc |
index 9b8a6df255cf6837051dbad7e75f140cd2b7fadd..81b67f2fe1ac063442b72f9ea9a9b0e6890763ad 100644 |
--- a/ui/aura/window.cc |
+++ b/ui/aura/window.cc |
@@ -893,18 +893,16 @@ void Window::StackChildRelativeTo(Window* child, |
// See tests WindowTest.StackingMadrigal and StackOverClosingTransient |
// for an explanation of this. |
while (final_target_i > 0 && |
- children_[final_target_i]->layer()->delegate() == NULL) { |
+ children_[direction == STACK_ABOVE ? final_target_i : |
+ final_target_i - 1]->layer() |
flackr
2013/11/04 22:04:12
This change should make the check in 901 unnecessa
|
+ ->delegate() == NULL) { |
--final_target_i; |
} |
- // Allow stacking immediately below a window with a NULL layer. |
- if (direction == STACK_BELOW && target_i != final_target_i) |
- direction = STACK_ABOVE; |
- |
Window* final_target = children_[final_target_i]; |
// If we couldn't find a valid target position, don't move anything. |
- if (final_target->layer()->delegate() == NULL) |
+ if (direction == STACK_ABOVE && final_target->layer()->delegate() == NULL) |
return; |
// Don't try to stack a child above itself. |