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

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: Changes as requested 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
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);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698