| Index: ui/compositor/layer_owner.cc
|
| diff --git a/ui/compositor/layer_owner.cc b/ui/compositor/layer_owner.cc
|
| index 227dfa9b364b6c514d0c9affdab6a53968fcbc6e..d874b4769f184d196edd39512ebfd65eb9f18ed1 100644
|
| --- a/ui/compositor/layer_owner.cc
|
| +++ b/ui/compositor/layer_owner.cc
|
| @@ -52,10 +52,14 @@ scoped_ptr<Layer> LayerOwner::RecreateLayer() {
|
| if (alpha_shape)
|
| new_layer->SetAlphaShape(make_scoped_ptr(new SkRegion(*alpha_shape)));
|
|
|
| - // Install new layer as a sibling of the old layer, stacked below it.
|
| if (old_layer->parent()) {
|
| + // Install new layer as a sibling of the old layer, stacked below it.
|
| old_layer->parent()->Add(new_layer);
|
| old_layer->parent()->StackBelow(new_layer, old_layer.get());
|
| + } else if (old_layer->GetCompositor()) {
|
| + // If old_layer was the layer tree root then we need to move the Compositor
|
| + // over to the new root.
|
| + old_layer->GetCompositor()->SetRootLayer(new_layer);
|
| }
|
|
|
| // Migrate all the child layers over to the new layer. Copy the list because
|
| @@ -68,12 +72,6 @@ scoped_ptr<Layer> LayerOwner::RecreateLayer() {
|
| new_layer->Add(child);
|
| }
|
|
|
| - // If old_layer was the layer tree root then we need to move the Compositor
|
| - // over to the new root.
|
| - const bool is_root = !old_layer->parent();
|
| - if (is_root && old_layer->GetCompositor())
|
| - old_layer->GetCompositor()->SetRootLayer(new_layer);
|
| -
|
| // Install the delegate last so that the delegate isn't notified as we copy
|
| // state to the new layer.
|
| new_layer->set_delegate(old_delegate);
|
|
|