Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(733)

Unified Diff: ui/views/view.cc

Issue 1461673002: Moved parent_->SchedulePaint() to Views::SetFillsBoundsOpaquely() and Views::SchedulePaint(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added ViewLayerTests to check paints scheduled on the parent. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698