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

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

Issue 15114002: Reorder the NativeViews attached to a view via kViewHostKey according to the position of the view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 layer_->set_delegate(this); 156 layer_->set_delegate(this);
157 layer_->SetMasksToBounds(old_layer->GetMasksToBounds()); 157 layer_->SetMasksToBounds(old_layer->GetMasksToBounds());
158 // Move the original texture to the new layer if the old layer has a 158 // Move the original texture to the new layer if the old layer has a
159 // texture and we could copy it into the old layer, 159 // texture and we could copy it into the old layer,
160 // crbug.com/175211. 160 // crbug.com/175211.
161 if (delegate_ && old_texture) 161 if (delegate_ && old_texture)
162 layer_->SetExternalTexture(old_texture); 162 layer_->SetExternalTexture(old_texture);
163 163
164 UpdateLayerName(name_); 164 UpdateLayerName(name_);
165 layer_->SetFillsBoundsOpaquely(!transparent_); 165 layer_->SetFillsBoundsOpaquely(!transparent_);
166 // Install new layer as a sibling of the old layer, stacked on top of it. 166 // Install new layer as a sibling of the old layer, stacked below it.
sky 2013/05/28 14:03:50 Document why it's important to stack below rather
pkotwicz 2013/05/28 15:15:00 This is actually a bad diff, this change is not pa
167 if (old_layer->parent()) { 167 if (old_layer->parent()) {
168 old_layer->parent()->Add(layer_); 168 old_layer->parent()->Add(layer_);
169 old_layer->parent()->StackAbove(layer_, old_layer); 169 old_layer->parent()->StackBelow(layer_, old_layer);
170 } 170 }
171 // Migrate all the child layers over to the new layer. Copy the list because 171 // Migrate all the child layers over to the new layer. Copy the list because
172 // the items are removed during iteration. 172 // the items are removed during iteration.
173 std::vector<ui::Layer*> children_copy = old_layer->children(); 173 std::vector<ui::Layer*> children_copy = old_layer->children();
174 for (std::vector<ui::Layer*>::const_iterator it = children_copy.begin(); 174 for (std::vector<ui::Layer*>::const_iterator it = children_copy.begin();
175 it != children_copy.end(); 175 it != children_copy.end();
176 ++it) { 176 ++it) {
177 ui::Layer* child = *it; 177 ui::Layer* child = *it;
178 layer_->Add(child); 178 layer_->Add(child);
179 } 179 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 void Window::StackChildAtTop(Window* child) { 333 void Window::StackChildAtTop(Window* child) {
334 if (children_.size() <= 1 || child == children_.back()) 334 if (children_.size() <= 1 || child == children_.back())
335 return; // In the front already. 335 return; // In the front already.
336 StackChildAbove(child, children_.back()); 336 StackChildAbove(child, children_.back());
337 } 337 }
338 338
339 void Window::StackChildAbove(Window* child, Window* target) { 339 void Window::StackChildAbove(Window* child, Window* target) {
340 StackChildRelativeTo(child, target, STACK_ABOVE); 340 StackChildRelativeTo(child, target, STACK_ABOVE);
341 } 341 }
342 342
343 void Window::StackChildAtBottom(Window* child) {
344 if (children_.size() <= 1 || child == children_.front())
345 return; // At the bottom already.
346 StackChildBelow(child, children_.front());
347 }
348
343 void Window::StackChildBelow(Window* child, Window* target) { 349 void Window::StackChildBelow(Window* child, Window* target) {
344 StackChildRelativeTo(child, target, STACK_BELOW); 350 StackChildRelativeTo(child, target, STACK_BELOW);
345 } 351 }
346 352
347 void Window::AddChild(Window* child) { 353 void Window::AddChild(Window* child) {
348 WindowObserver::HierarchyChangeParams params; 354 WindowObserver::HierarchyChangeParams params;
349 params.target = child; 355 params.target = child;
350 params.new_parent = this; 356 params.new_parent = this;
351 params.old_parent = child->parent(); 357 params.old_parent = child->parent();
352 params.phase = WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGING; 358 params.phase = WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGING;
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 bool contains_mouse = false; 1106 bool contains_mouse = false;
1101 if (IsVisible()) { 1107 if (IsVisible()) {
1102 RootWindow* root_window = GetRootWindow(); 1108 RootWindow* root_window = GetRootWindow();
1103 contains_mouse = root_window && 1109 contains_mouse = root_window &&
1104 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); 1110 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot());
1105 } 1111 }
1106 return contains_mouse; 1112 return contains_mouse;
1107 } 1113 }
1108 1114
1109 } // namespace aura 1115 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698