diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-31 14:25:00 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-31 14:25:00 +0000 |
commit | 636dc1624585ca5c4c3ae2e028413cd572554a63 (patch) | |
tree | ff01227e061e016dfb47e0a82bf0a91f183ac3b4 /ui/views/view.cc | |
parent | acd431ee877258e7ad24eb9b0c925d5d237de95a (diff) | |
download | chromium_src-636dc1624585ca5c4c3ae2e028413cd572554a63.zip chromium_src-636dc1624585ca5c4c3ae2e028413cd572554a63.tar.gz chromium_src-636dc1624585ca5c4c3ae2e028413cd572554a63.tar.bz2 |
Revert 203217 "Revert 202987 "Reorder the NativeViews attached t..."
I reverted it yesterday because I thought it was burning the Aura tree. It turned out to be innocent so I'm putting it back.
TBR=avi@chromium.org
Review URL: https://codereview.chromium.org/16256004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203402 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/view.cc')
-rw-r--r-- | ui/views/view.cc | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/ui/views/view.cc b/ui/views/view.cc index 43719f3..18656ea 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); + } } } |