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

Side by Side Diff: ui/aura/window.cc

Issue 58343004: Allow stacking below windows with layers with NULL delegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 children_[final_target_i + 1]->HasTransientAncestor(target)) { 886 children_[final_target_i + 1]->HasTransientAncestor(target)) {
887 ++final_target_i; 887 ++final_target_i;
888 } 888 }
889 } 889 }
890 890
891 // By convention we don't stack on top of windows with layers with NULL 891 // By convention we don't stack on top of windows with layers with NULL
892 // delegates. Walk backward to find a valid target window. 892 // delegates. Walk backward to find a valid target window.
893 // See tests WindowTest.StackingMadrigal and StackOverClosingTransient 893 // See tests WindowTest.StackingMadrigal and StackOverClosingTransient
894 // for an explanation of this. 894 // for an explanation of this.
895 while (final_target_i > 0 && 895 while (final_target_i > 0 &&
896 children_[final_target_i]->layer()->delegate() == NULL) { 896 children_[direction == STACK_ABOVE ? final_target_i :
897 final_target_i - 1]->layer()
flackr 2013/11/04 22:04:12 This change should make the check in 901 unnecessa
898 ->delegate() == NULL) {
897 --final_target_i; 899 --final_target_i;
898 } 900 }
899 901
900 // Allow stacking immediately below a window with a NULL layer.
901 if (direction == STACK_BELOW && target_i != final_target_i)
902 direction = STACK_ABOVE;
903
904 Window* final_target = children_[final_target_i]; 902 Window* final_target = children_[final_target_i];
905 903
906 // If we couldn't find a valid target position, don't move anything. 904 // If we couldn't find a valid target position, don't move anything.
907 if (final_target->layer()->delegate() == NULL) 905 if (direction == STACK_ABOVE && final_target->layer()->delegate() == NULL)
908 return; 906 return;
909 907
910 // Don't try to stack a child above itself. 908 // Don't try to stack a child above itself.
911 if (child == final_target) 909 if (child == final_target)
912 return; 910 return;
913 911
914 // Move the child. 912 // Move the child.
915 StackChildRelativeToImpl(child, final_target, direction); 913 StackChildRelativeToImpl(child, final_target, direction);
916 914
917 // Stack any transient children that share the same parent to be in front of 915 // Stack any transient children that share the same parent to be in front of
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 bool contains_mouse = false; 1147 bool contains_mouse = false;
1150 if (IsVisible()) { 1148 if (IsVisible()) {
1151 WindowEventDispatcher* dispatcher = GetDispatcher(); 1149 WindowEventDispatcher* dispatcher = GetDispatcher();
1152 contains_mouse = dispatcher && 1150 contains_mouse = dispatcher &&
1153 ContainsPointInRoot(dispatcher->GetLastMouseLocationInRoot()); 1151 ContainsPointInRoot(dispatcher->GetLastMouseLocationInRoot());
1154 } 1152 }
1155 return contains_mouse; 1153 return contains_mouse;
1156 } 1154 }
1157 1155
1158 } // namespace aura 1156 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698