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

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: Changed View to schedule a parent paint only when paint to layer, or fills bounds opaquely changed. Created 5 years, 1 month 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') | no next file » | 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 0fc755972d6d57de055a7ea9d31fa11733eaf13b..844b1e6bdc775414c169abe35e13149ea0cceb32 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -461,6 +461,7 @@ void View::SetPaintToLayer(bool paint_to_layer) {
paint_to_layer_ = paint_to_layer;
if (paint_to_layer_ && !layer()) {
CreateLayer();
+ SchedulePaintOnParent();
sky 2015/11/19 22:31:48 Why does this case necessitate a paint on the pare
bruthig 2015/12/22 22:32:40 Done.
} else if (!paint_to_layer_ && layer()) {
DestroyLayer();
}
@@ -1384,8 +1385,13 @@ 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())
+ if (layer()) {
+ bool schedule_paint_on_parent =
sky 2015/11/19 22:31:48 Please add an early return to make this code easie
bruthig 2015/12/22 22:32:40 Done.
+ !fills_bounds_opaquely && layer()->fills_bounds_opaquely();
layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely);
+ if (schedule_paint_on_parent)
+ SchedulePaintOnParent();
+ }
}
gfx::Vector2d View::CalculateOffsetToAncestorWithLayer(
@@ -1733,6 +1739,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(bounds_));
+ }
+}
+
// Tree operations -------------------------------------------------------------
void View::DoRemoveChildView(View* view,
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698