Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/property_tree_builder.h" | 5 #include "cc/trees/property_tree_builder.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 const bool render_surface_may_grow_due_to_clip_children = | 72 const bool render_surface_may_grow_due_to_clip_children = |
| 73 layer->render_surface() && layer->num_unclipped_descendants() > 0; | 73 layer->render_surface() && layer->num_unclipped_descendants() > 0; |
| 74 | 74 |
| 75 if (layer->masks_to_bounds() || layer->mask_layer() || | 75 if (layer->masks_to_bounds() || layer->mask_layer() || |
| 76 render_surface_may_grow_due_to_clip_children) | 76 render_surface_may_grow_due_to_clip_children) |
| 77 return true; | 77 return true; |
| 78 | 78 |
| 79 if (!render_surface_applies_clip) | 79 if (!render_surface_applies_clip) |
| 80 return false; | 80 return false; |
| 81 | 81 |
| 82 if (!layer->transform().IsFlat()) | |
|
ajuma
2015/08/04 15:37:19
What if the transform is animated, and becomes non
jaydasika
2015/08/04 15:38:53
That breaks a lot of unit tests.
ajuma
2015/08/04 15:40:26
It'd be good to understand why (since if there's s
| |
| 83 return true; | |
| 84 | |
| 82 bool axis_aligned_with_respect_to_parent = | 85 bool axis_aligned_with_respect_to_parent = |
| 83 data.transform_tree->Are2DAxisAligned(layer->transform_tree_index(), | 86 data.transform_tree->Are2DAxisAligned(layer->transform_tree_index(), |
| 84 parent_transform_id); | 87 parent_transform_id); |
| 85 | 88 |
| 86 return !axis_aligned_with_respect_to_parent; | 89 return !axis_aligned_with_respect_to_parent; |
| 87 } | 90 } |
| 88 | 91 |
| 89 template <typename LayerType> | 92 template <typename LayerType> |
| 90 static bool LayerClipsSubtree(LayerType* layer) { | 93 static bool LayerClipsSubtree(LayerType* layer) { |
| 91 return layer->masks_to_bounds() || layer->mask_layer(); | 94 return layer->masks_to_bounds() || layer->mask_layer(); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 115 data_for_children->ancestor_clips_subtree = ancestor_clips_subtree; | 118 data_for_children->ancestor_clips_subtree = ancestor_clips_subtree; |
| 116 } | 119 } |
| 117 | 120 |
| 118 if (LayerClipsSubtree(layer)) | 121 if (LayerClipsSubtree(layer)) |
| 119 data_for_children->ancestor_clips_subtree = true; | 122 data_for_children->ancestor_clips_subtree = true; |
| 120 | 123 |
| 121 if (has_unclipped_surface) | 124 if (has_unclipped_surface) |
| 122 parent_id = 0; | 125 parent_id = 0; |
| 123 | 126 |
| 124 if (!RequiresClipNode(layer, data_from_ancestor, parent->data.transform_id, | 127 if (!RequiresClipNode(layer, data_from_ancestor, parent->data.transform_id, |
| 125 data_for_children->ancestor_clips_subtree)) { | 128 ancestor_clips_subtree)) { |
| 126 // Unclipped surfaces reset the clip rect. | 129 // Unclipped surfaces reset the clip rect. |
| 127 data_for_children->clip_tree_parent = parent_id; | 130 data_for_children->clip_tree_parent = parent_id; |
| 128 } else { | 131 } else { |
| 129 LayerType* transform_parent = data_for_children->transform_tree_parent; | 132 LayerType* transform_parent = data_for_children->transform_tree_parent; |
| 130 if (layer->position_constraint().is_fixed_position() && | 133 if (layer->position_constraint().is_fixed_position() && |
| 131 !created_transform_node) { | 134 !created_transform_node) { |
| 132 transform_parent = data_for_children->transform_fixed_parent; | 135 transform_parent = data_for_children->transform_fixed_parent; |
| 133 } | 136 } |
| 134 ClipNode node; | 137 ClipNode node; |
| 135 node.data.clip = gfx::RectF( | 138 node.data.clip = gfx::RectF( |
| 136 gfx::PointF() + layer->offset_to_transform_parent(), layer->bounds()); | 139 gfx::PointF() + layer->offset_to_transform_parent(), layer->bounds()); |
| 137 node.data.transform_id = transform_parent->transform_tree_index(); | 140 node.data.transform_id = transform_parent->transform_tree_index(); |
| 138 node.data.target_id = | 141 node.data.target_id = |
| 139 data_for_children->render_target->transform_tree_index(); | 142 data_for_children->render_target->transform_tree_index(); |
| 140 node.owner_id = layer->id(); | 143 node.owner_id = layer->id(); |
| 144 node.data.inherit_parent_target_space_clip = | |
| 145 !data_for_children->ancestor_clips_subtree && | |
| 146 layer->has_render_surface() && ancestor_clips_subtree; | |
| 141 | 147 |
| 142 data_for_children->clip_tree_parent = | 148 data_for_children->clip_tree_parent = |
| 143 data_for_children->clip_tree->Insert(node, parent_id); | 149 data_for_children->clip_tree->Insert(node, parent_id); |
| 144 } | 150 } |
| 145 | 151 |
| 146 layer->SetClipTreeIndex( | 152 layer->SetClipTreeIndex( |
| 147 has_unclipped_surface ? 0 : data_for_children->clip_tree_parent); | 153 has_unclipped_surface ? 0 : data_for_children->clip_tree_parent); |
| 148 | 154 |
| 149 layer->set_is_clipped(data_for_children->ancestor_clips_subtree); | 155 layer->set_is_clipped(data_for_children->ancestor_clips_subtree); |
| 150 | 156 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 500 const gfx::Rect& viewport, | 506 const gfx::Rect& viewport, |
| 501 const gfx::Transform& device_transform, | 507 const gfx::Transform& device_transform, |
| 502 PropertyTrees* property_trees) { | 508 PropertyTrees* property_trees) { |
| 503 BuildPropertyTreesTopLevelInternal( | 509 BuildPropertyTreesTopLevelInternal( |
| 504 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 510 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 505 outer_viewport_scroll_layer, page_scale_factor, device_scale_factor, | 511 outer_viewport_scroll_layer, page_scale_factor, device_scale_factor, |
| 506 viewport, device_transform, property_trees); | 512 viewport, device_transform, property_trees); |
| 507 } | 513 } |
| 508 | 514 |
| 509 } // namespace cc | 515 } // namespace cc |
| OLD | NEW |