Index: ui/views/view.cc |
diff --git a/ui/views/view.cc b/ui/views/view.cc |
index e085544e1a524354f2a09cfd51a9e5e5b6ac5266..38b420a2b4d95210ad017f3032f34ff7626a6199 100644 |
--- a/ui/views/view.cc |
+++ b/ui/views/view.cc |
@@ -452,8 +452,10 @@ void View::SetTransform(const gfx::Transform& transform) { |
// Nothing. |
} |
} else { |
- if (!layer()) |
+ if (!layer()) { |
CreateLayer(); |
+ // TODO(bruthig): Should a paint be scheduled on the parent here? |
+ } |
layer()->SetTransform(transform); |
layer()->ScheduleDraw(); |
} |
@@ -466,6 +468,8 @@ void View::SetPaintToLayer(bool paint_to_layer) { |
paint_to_layer_ = paint_to_layer; |
if (paint_to_layer_ && !layer()) { |
CreateLayer(); |
+ // The parent layer may be dirty due to a previous paint by |this|. |
+ SchedulePaintOnParent(); |
sky
2015/12/27 23:55:04
I think you should move this to CreateLayer, just
bruthig
2016/01/04 19:00:15
Done.
|
} else if (!paint_to_layer_ && layer()) { |
DestroyLayer(); |
} |
@@ -1418,8 +1422,12 @@ void View::OnPaintBorder(gfx::Canvas* canvas) { |
void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { |
// This method should not have the side-effect of creating the layer. |
- if (layer()) |
- layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); |
+ if (!layer() || layer()->fills_bounds_opaquely() == fills_bounds_opaquely) |
+ return; |
+ |
+ layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); |
+ if (!fills_bounds_opaquely) |
+ SchedulePaintOnParent(); |
sky
2015/12/27 23:55:04
I'm not following why this needed. If it is needed
bruthig
2016/01/04 19:00:15
Removed, I talked with ajuma@ about layers and thi
|
} |
gfx::Vector2d View::CalculateOffsetToAncestorWithLayer( |
@@ -1767,6 +1775,14 @@ void View::SchedulePaintBoundsChanged(SchedulePaintType type) { |
} |
} |
+void View::SchedulePaintOnParent() { |
+ if (parent_) { |
+ // Translate the requested paint rect to the parent's coordinate system |
+ // then pass this notification up to the parent. |
+ parent_->SchedulePaintInRect(ConvertRectToParent(GetLocalBounds())); |
+ } |
+} |
+ |
// Tree operations ------------------------------------------------------------- |
void View::DoRemoveChildView(View* view, |