Chromium Code Reviews| Index: cc/layer_tree_host_common.cc |
| diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc |
| index 0a204ceb6914df96a5bdede2b6c8c9ee7e1c6915..90bc1c9228c41ad3e75be70db7a57d9f73b0bc42 100644 |
| --- a/cc/layer_tree_host_common.cc |
| +++ b/cc/layer_tree_host_common.cc |
| @@ -274,7 +274,7 @@ static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig |
| return true; |
| // If the layer clips its descendants but it is not axis-aligned with respect to its parent. |
| - if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && numDescendantsThatDrawContent > 0) |
| + if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && !layer->drawProperties().can_clip_self) |
|
danakj
2012/12/15 18:49:12
Why doesn't a layer need to know that all layers i
|
| return true; |
| // If the layer has some translucency and does not have a preserves-3d transform style. |
| @@ -435,15 +435,25 @@ template<typename LayerType> |
| static void preCalculateMetaInformation(LayerType* layer) |
| { |
| int numDescendantsThatDrawContent = 0; |
| + bool canClipSelf = true; |
|
danakj
2012/12/15 18:49:12
Why isn't this initialized to the return for the c
|
| + bool sublayerXformPreventsClip = !layer->sublayerTransform().IsPositiveScaleOrTranslation(); |
| for (size_t i = 0; i < layer->children().size(); ++i) { |
| LayerType* childLayer = layer->children()[i]; |
| preCalculateMetaInformation<LayerType>(childLayer); |
| + |
| numDescendantsThatDrawContent += childLayer->drawsContent() ? 1 : 0; |
| numDescendantsThatDrawContent += childLayer->drawProperties().num_descendants_that_draw_content; |
| + |
| + if ((childLayer->drawsContent() && !childLayer->canClipSelf()) || |
| + !childLayer->drawProperties().can_clip_self || |
| + sublayerXformPreventsClip || |
| + !childLayer->transform().IsPositiveScaleOrTranslation()) |
| + canClipSelf = false; |
| } |
| layer->drawProperties().num_descendants_that_draw_content = numDescendantsThatDrawContent; |
| + layer->drawProperties().can_clip_self = canClipSelf; |
| } |
| // Recursively walks the layer tree starting at the given node and computes all the |