Chromium Code Reviews| Index: cc/trees/property_tree_builder.cc |
| diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc |
| index 8ad44070ec7ffdf6d648c6356e6673153b9366d3..cf628fa6ad4f322d96ef601352bfdd6766ce65bc 100644 |
| --- a/cc/trees/property_tree_builder.cc |
| +++ b/cc/trees/property_tree_builder.cc |
| @@ -79,6 +79,9 @@ static bool RequiresClipNode(LayerType* layer, |
| if (!render_surface_applies_clip) |
| return false; |
| + if (layer->parent()) |
| + return true; |
| + |
| bool axis_aligned_with_respect_to_parent = |
|
ajuma
2015/08/05 13:51:09
Will this ever be true now? If we reach this point
jaydasika
2015/08/05 15:07:20
Done.
|
| data.transform_tree->Are2DAxisAligned(layer->transform_tree_index(), |
| parent_transform_id); |
| @@ -105,6 +108,7 @@ void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, |
| data_for_children->ancestor_clips_subtree = false; |
| bool has_unclipped_surface = false; |
| + bool use_clip_parent_for_layer = false; |
| if (layer->has_render_surface()) { |
| if (ancestor_clips_subtree && layer->num_unclipped_descendants() > 0) |
| @@ -122,7 +126,7 @@ void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, |
| parent_id = 0; |
| if (!RequiresClipNode(layer, data_from_ancestor, parent->data.transform_id, |
| - data_for_children->ancestor_clips_subtree)) { |
| + ancestor_clips_subtree)) { |
| // Unclipped surfaces reset the clip rect. |
| data_for_children->clip_tree_parent = parent_id; |
| } else { |
| @@ -138,13 +142,19 @@ void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, |
| node.data.target_id = |
| data_for_children->render_target->transform_tree_index(); |
| node.owner_id = layer->id(); |
| - |
| + node.data.inherit_parent_target_space_clip = |
| + !data_for_children->ancestor_clips_subtree && |
| + layer->has_render_surface() && ancestor_clips_subtree; |
| + if (node.data.inherit_parent_target_space_clip) |
| + use_clip_parent_for_layer = true; |
| data_for_children->clip_tree_parent = |
| data_for_children->clip_tree->Insert(node, parent_id); |
| } |
| layer->SetClipTreeIndex( |
| has_unclipped_surface ? 0 : data_for_children->clip_tree_parent); |
| + if (use_clip_parent_for_layer) |
| + layer->SetClipTreeIndex(data_from_ancestor.clip_tree_parent); |
| layer->set_is_clipped(data_for_children->ancestor_clips_subtree); |