Chromium Code Reviews| Index: ui/views/view.cc |
| diff --git a/ui/views/view.cc b/ui/views/view.cc |
| index d65f4bc25926d324ee7ea48ed5732ec678c93523..b490aee549150b7471bc89b62b74a2102f4adaba 100644 |
| --- a/ui/views/view.cc |
| +++ b/ui/views/view.cc |
| @@ -31,6 +31,7 @@ |
| #include "ui/compositor/dip_util.h" |
| #include "ui/compositor/layer.h" |
| #include "ui/compositor/layer_animator.h" |
| +#include "ui/compositor/layer_type.h" |
| #include "ui/compositor/paint_context.h" |
| #include "ui/compositor/paint_recorder.h" |
| #include "ui/compositor/transform_recorder.h" |
| @@ -523,19 +524,20 @@ void View::SetTransform(const gfx::Transform& transform) { |
| } |
| } else { |
| if (!layer()) |
| - CreateLayer(); |
| + CreateLayer(ui::LAYER_TEXTURED); |
| layer()->SetTransform(transform); |
| layer()->ScheduleDraw(); |
| } |
| } |
| -void View::SetPaintToLayer(bool paint_to_layer) { |
| - if (paint_to_layer_ == paint_to_layer) |
| +void View::SetPaintToLayer(ui::LayerType layer_type) { |
| + bool is_paint_layer = !(layer_type == ui::LAYER_NOT_DRAWN); |
|
sadrul
2017/01/20 19:50:11
layer_type != ui::LAYER_NOT_DRAW
|
| + if (is_paint_layer == paint_to_layer_) |
| return; |
| - paint_to_layer_ = paint_to_layer; |
| + paint_to_layer_ = is_paint_layer; |
| if (paint_to_layer_ && !layer()) { |
| - CreateLayer(); |
| + CreateLayer(layer_type); |
| } else if (!paint_to_layer_ && layer()) { |
| DestroyLayer(); |
| } |
| @@ -2184,7 +2186,7 @@ bool View::ConvertRectFromAncestor(const View* ancestor, |
| // Accelerated painting -------------------------------------------------------- |
| -void View::CreateLayer() { |
| +void View::CreateLayer(ui::LayerType layer_type) { |
| // A new layer is being created for the view. So all the layers of the |
| // sub-tree can inherit the visibility of the corresponding view. |
| { |
| @@ -2193,7 +2195,7 @@ void View::CreateLayer() { |
| child->UpdateChildLayerVisibility(true); |
| } |
| - SetLayer(base::MakeUnique<ui::Layer>()); |
| + SetLayer(base::MakeUnique<ui::Layer>(layer_type)); |
| layer()->set_delegate(this); |
| layer()->set_name(GetClassName()); |