Cherry-pick with modification: cc: PictureLayerImpl with empty bounds should not have tiles
Cherry-pick of Chromium crrev.com/r230368.
Removed changes to add new test to avoid gyp/mk churn.
BUG: 11288267
Original description:
If a PictureLayer bounds is set to from non-empty to empty,
PictureLayer::Update is skipped so the picture pile is not
updated. In this case, the PictureLayerImpl should not have
tilings.
Change-Id: Ib022c99a34d2933dd2aba37bffd616fa114eaf42
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index 889e2fb..c84ade3 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -41,6 +41,18 @@
// This should be first so others can use it.
layer_impl->UpdateTwinLayer();
+ if (layer_impl->bounds().IsEmpty()) {
+ // Update may not get called for an empty layer, so resize here instead.
+ // Using layer_impl because either bounds() or paint_properties().bounds
+ // may disagree and either one could have been pushed to layer_impl.
+ pile_->Resize(layer_impl->bounds());
+ pile_->UpdateRecordedRegion();
+ }
+
+ if (DrawsContent()) {
+ DCHECK(paint_properties().bounds == pile_->size());
+ }
+
layer_impl->SetIsMask(is_mask_);
layer_impl->CreateTilingSetIfNeeded();
// Unlike other properties, invalidation must always be set on layer_impl.