| Index: ui/views/view.cc
|
| diff --git a/ui/views/view.cc b/ui/views/view.cc
|
| index 27eada4660d6798ae106657b69e53a3358dd1d72..6b231e9b15dc3498c65ef3322b7443069520cd7d 100644
|
| --- a/ui/views/view.cc
|
| +++ b/ui/views/view.cc
|
| @@ -537,16 +537,39 @@
|
| if (paint_to_layer_ && (layer()->type() == layer_type))
|
| return;
|
|
|
| - DestroyLayerImpl(LayerChangeNotifyBehavior::DONT_NOTIFY);
|
| + DestroyLayer();
|
| CreateLayer(layer_type);
|
| paint_to_layer_ = true;
|
| -
|
| - // Notify the parent chain about the layer change.
|
| - NotifyParentsOfLayerChange();
|
| }
|
|
|
| void View::DestroyLayer() {
|
| - DestroyLayerImpl(LayerChangeNotifyBehavior::NOTIFY);
|
| + if (!paint_to_layer_)
|
| + return;
|
| +
|
| + paint_to_layer_ = false;
|
| + if (!layer())
|
| + return;
|
| +
|
| + ui::Layer* new_parent = layer()->parent();
|
| + std::vector<ui::Layer*> children = layer()->children();
|
| + for (size_t i = 0; i < children.size(); ++i) {
|
| + layer()->Remove(children[i]);
|
| + if (new_parent)
|
| + new_parent->Add(children[i]);
|
| + }
|
| +
|
| + LayerOwner::DestroyLayer();
|
| +
|
| + if (new_parent)
|
| + ReorderLayers();
|
| +
|
| + UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL));
|
| +
|
| + SchedulePaint();
|
| +
|
| + Widget* widget = GetWidget();
|
| + if (widget)
|
| + widget->LayerTreeChanged();
|
| }
|
|
|
| std::unique_ptr<ui::Layer> View::RecreateLayer() {
|
| @@ -1605,49 +1628,6 @@
|
| }
|
| }
|
|
|
| -void View::DestroyLayerImpl(LayerChangeNotifyBehavior notify_parents) {
|
| - if (!paint_to_layer_)
|
| - return;
|
| -
|
| - paint_to_layer_ = false;
|
| - if (!layer())
|
| - return;
|
| -
|
| - ui::Layer* new_parent = layer()->parent();
|
| - std::vector<ui::Layer*> children = layer()->children();
|
| - for (size_t i = 0; i < children.size(); ++i) {
|
| - layer()->Remove(children[i]);
|
| - if (new_parent)
|
| - new_parent->Add(children[i]);
|
| - }
|
| -
|
| - LayerOwner::DestroyLayer();
|
| -
|
| - if (new_parent)
|
| - ReorderLayers();
|
| -
|
| - UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL));
|
| -
|
| - SchedulePaint();
|
| -
|
| - // Notify the parent chain about the layer change.
|
| - if (notify_parents == LayerChangeNotifyBehavior::NOTIFY)
|
| - NotifyParentsOfLayerChange();
|
| -
|
| - Widget* widget = GetWidget();
|
| - if (widget)
|
| - widget->LayerTreeChanged();
|
| -}
|
| -
|
| -void View::NotifyParentsOfLayerChange() {
|
| - // Notify the parent chain about the layer change.
|
| - View* view_parent = parent();
|
| - while (view_parent) {
|
| - view_parent->OnChildLayerChanged(this);
|
| - view_parent = view_parent->parent();
|
| - }
|
| -}
|
| -
|
| void View::UpdateChildLayerBounds(const gfx::Vector2d& offset) {
|
| if (layer()) {
|
| SetLayerBounds(GetLocalBounds() + offset);
|
| @@ -1715,8 +1695,6 @@
|
| child->ReorderChildLayers(parent_layer);
|
| }
|
| }
|
| -
|
| -void View::OnChildLayerChanged(View* child) {}
|
|
|
| // Input -----------------------------------------------------------------------
|
|
|
|
|