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

Unified Diff: ui/views/view.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_constants_aura.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 43719f3681104385fa109ad928e868707c74bbc9..18656ea69ca23042e454ba3ef212d12f522203cd 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -535,12 +535,6 @@ ui::Layer* View::RecreateLayer() {
return NULL;
CreateLayer();
-
- // TODO(pkotwicz): Remove this once ReorderLayers() stacks layers not attached
- // to a view above layers attached to a view.
- if (layer->parent())
- layer->parent()->StackAtTop(layer);
-
layer_->set_scale_content(layer->scale_content());
return layer;
}
@@ -1458,8 +1452,8 @@ void View::ReorderLayers() {
while (v && !v->layer())
v = v->parent();
+ Widget* widget = GetWidget();
if (!v) {
- Widget* widget = GetWidget();
if (widget) {
ui::Layer* layer = widget->GetLayer();
if (layer)
@@ -1468,15 +1462,29 @@ void View::ReorderLayers() {
} else {
v->ReorderChildLayers(v->layer());
}
+
+ if (widget) {
+ // Reorder the widget's child NativeViews in case a child NativeView is
+ // associated with a view (eg via a NativeViewHost). Always do the
+ // reordering because the associated NativeView's layer (if it has one)
+ // is parented to the widget's layer regardless of whether the host view has
+ // an ancestor with a layer.
+ widget->ReorderNativeViews();
+ }
}
void View::ReorderChildLayers(ui::Layer* parent_layer) {
if (layer() && layer() != parent_layer) {
DCHECK_EQ(parent_layer, layer()->parent());
- parent_layer->StackAtTop(layer());
+ parent_layer->StackAtBottom(layer());
} else {
- for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i)
- (*i)->ReorderChildLayers(parent_layer);
+ // Iterate backwards through the children so that a child with a layer
+ // which is further to the back is stacked above one which is further to
+ // the front.
+ for (Views::const_reverse_iterator it(children_.rbegin());
+ it != children_.rend(); ++it) {
+ (*it)->ReorderChildLayers(parent_layer);
+ }
}
}
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_constants_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698