Index: ui/views/view.cc |
diff --git a/ui/views/view.cc b/ui/views/view.cc |
index 1bd94c018918cfaa23f8cf074dcba2bc45aec5f7..17420cc1094f3e745e2c3a293afc65745e2ca639 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,25 @@ void View::ReorderLayers() { |
} else { |
v->ReorderChildLayers(v->layer()); |
} |
+ |
+ if (widget) { |
+ // Reorder layers for NativeViews attached to a view (eg via a |
+ // NativeViewHost). Always do the reordering because the attached |
+ // NativeView's layer is parented to the widget's layer regardless of |
+ // whether the host view has an ancestor with a layer. |
+ widget->ReorderLayersForAttachedNativeViews(); |
+ } |
} |
void View::ReorderChildLayers(ui::Layer* parent_layer) { |
if (layer() && layer() != parent_layer) { |
sky
2013/05/24 15:57:26
It's subtle that we iterate backward. And subtle c
pkotwicz
2013/05/26 04:12:15
Done.
|
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); |
+ for (Views::const_reverse_iterator it(children_.rbegin()); |
+ it != children_.rend(); ++it) { |
+ (*it)->ReorderChildLayers(parent_layer); |
+ } |
} |
} |