Chromium Code Reviews| Index: ui/views/view.cc |
| diff --git a/ui/views/view.cc b/ui/views/view.cc |
| index 83192d8c93df41d122c633fa68f89130182ba0cb..050b22a2f15cd0a21338dd920e7f70f8f2d555e3 100644 |
| --- a/ui/views/view.cc |
| +++ b/ui/views/view.cc |
| @@ -296,6 +296,8 @@ void View::ReorderChildView(View* view, int index) { |
| ReorderLayers(); |
| } |
| +void View::OnChildLayerChanged(View* child) {} |
| + |
| void View::RemoveChildView(View* view) { |
| DoRemoveChildView(view, true, true, false, NULL); |
| } |
| @@ -540,6 +542,9 @@ void View::SetPaintToLayer(ui::LayerType layer_type) { |
| DestroyLayer(); |
|
sky
2017/04/18 15:35:48
When called from here DestroyLayer() should not ca
ananta
2017/04/18 22:22:39
Done.
|
| CreateLayer(layer_type); |
| paint_to_layer_ = true; |
| + |
| + // Notify the parent chain about the layer change. |
| + NotifyParentsOfLayerChange(); |
| } |
| void View::DestroyLayer() { |
| @@ -567,6 +572,9 @@ void View::DestroyLayer() { |
| SchedulePaint(); |
| + // Notify the parent chain about the layer change. |
| + NotifyParentsOfLayerChange(); |
| + |
| Widget* widget = GetWidget(); |
| if (widget) |
| widget->LayerTreeChanged(); |
| @@ -2650,4 +2658,13 @@ bool View::DoDrag(const ui::LocatedEvent& event, |
| return true; |
| } |
| +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(); |
| + } |
| +} |
| + |
| } // namespace views |