OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/corewm/transient_window_stacking_client.h" | 5 #include "ui/views/corewm/transient_window_stacking_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 using aura::Window; | 9 using aura::Window; |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 } // namespace | 63 } // namespace |
64 | 64 |
65 TransientWindowStackingClient::TransientWindowStackingClient() { | 65 TransientWindowStackingClient::TransientWindowStackingClient() { |
66 } | 66 } |
67 | 67 |
68 TransientWindowStackingClient::~TransientWindowStackingClient() { | 68 TransientWindowStackingClient::~TransientWindowStackingClient() { |
69 } | 69 } |
70 | 70 |
71 void TransientWindowStackingClient::AdjustStacking( | 71 bool TransientWindowStackingClient::AdjustStacking( |
72 Window** child, | 72 Window** child, |
73 Window** target, | 73 Window** target, |
74 Window::StackDirection* direction) { | 74 Window::StackDirection* direction) { |
75 // For windows that have transient children stack the transient ancestors that | 75 // For windows that have transient children stack the transient ancestors that |
76 // are siblings. This prevents one transient group from being inserted in the | 76 // are siblings. This prevents one transient group from being inserted in the |
77 // middle of another. | 77 // middle of another. |
78 FindCommonTransientAncestor(child, target); | 78 FindCommonTransientAncestor(child, target); |
79 | 79 |
80 // When stacking above skip to the topmost transient descendant of the target. | 80 // When stacking above skip to the topmost transient descendant of the target. |
81 if (*direction == Window::STACK_ABOVE && | 81 if (*direction == Window::STACK_ABOVE && |
82 !HasTransientAncestor(*child, *target)) { | 82 !HasTransientAncestor(*child, *target)) { |
83 const Window::Windows& siblings((*child)->parent()->children()); | 83 const Window::Windows& siblings((*child)->parent()->children()); |
84 size_t target_i = | 84 size_t target_i = |
85 std::find(siblings.begin(), siblings.end(), *target) - siblings.begin(); | 85 std::find(siblings.begin(), siblings.end(), *target) - siblings.begin(); |
86 while (target_i + 1 < siblings.size() && | 86 while (target_i + 1 < siblings.size() && |
87 HasTransientAncestor(siblings[target_i + 1], *target)) { | 87 HasTransientAncestor(siblings[target_i + 1], *target)) { |
88 ++target_i; | 88 ++target_i; |
89 } | 89 } |
90 *target = siblings[target_i]; | 90 *target = siblings[target_i]; |
91 } | 91 } |
| 92 return true; |
92 } | 93 } |
93 | 94 |
94 } // namespace corewm | 95 } // namespace corewm |
95 } // namespace views | 96 } // namespace views |
OLD | NEW |