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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 template <typename LayerType> | 94 template <typename LayerType> |
95 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, | 95 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, |
96 LayerType* layer, | 96 LayerType* layer, |
97 bool created_transform_node, | 97 bool created_transform_node, |
98 DataForRecursion<LayerType>* data_for_children) { | 98 DataForRecursion<LayerType>* data_for_children) { |
99 ClipNode* parent = GetClipParent(data_from_ancestor, layer); | 99 ClipNode* parent = GetClipParent(data_from_ancestor, layer); |
100 int parent_id = parent->id; | 100 int parent_id = parent->id; |
101 | 101 |
102 bool ancestor_clips_subtree = | 102 bool ancestor_clips_subtree = |
103 data_from_ancestor.ancestor_clips_subtree || layer->clip_parent(); | 103 data_from_ancestor.ancestor_clips_subtree || |
| 104 (layer->clip_parent() && layer->clip_parent()->is_clipped()); |
104 | 105 |
105 data_for_children->ancestor_clips_subtree = false; | 106 data_for_children->ancestor_clips_subtree = false; |
106 bool has_unclipped_surface = false; | 107 bool has_unclipped_surface = false; |
107 | 108 |
108 if (layer->has_render_surface()) { | 109 if (layer->has_render_surface()) { |
109 if (ancestor_clips_subtree && layer->num_unclipped_descendants() > 0) | 110 if (ancestor_clips_subtree && layer->num_unclipped_descendants() > 0) |
110 data_for_children->ancestor_clips_subtree = true; | 111 data_for_children->ancestor_clips_subtree = true; |
111 else if (!ancestor_clips_subtree && !layer->num_unclipped_descendants()) | 112 else if (!ancestor_clips_subtree && !layer->num_unclipped_descendants()) |
112 has_unclipped_surface = true; | 113 has_unclipped_surface = true; |
113 } else { | 114 } else { |
(...skipping 24 matching lines...) Expand all Loading... |
138 data_for_children->render_target->transform_tree_index(); | 139 data_for_children->render_target->transform_tree_index(); |
139 node.owner_id = layer->id(); | 140 node.owner_id = layer->id(); |
140 | 141 |
141 data_for_children->clip_tree_parent = | 142 data_for_children->clip_tree_parent = |
142 data_for_children->clip_tree->Insert(node, parent_id); | 143 data_for_children->clip_tree->Insert(node, parent_id); |
143 } | 144 } |
144 | 145 |
145 layer->SetClipTreeIndex( | 146 layer->SetClipTreeIndex( |
146 has_unclipped_surface ? 0 : data_for_children->clip_tree_parent); | 147 has_unclipped_surface ? 0 : data_for_children->clip_tree_parent); |
147 | 148 |
| 149 layer->set_is_clipped(data_for_children->ancestor_clips_subtree); |
| 150 |
148 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the | 151 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the |
149 // clip for all children since we may need to draw. We need to figure out a | 152 // clip for all children since we may need to draw. We need to figure out a |
150 // better way, since we will need both the clipped and unclipped versions. | 153 // better way, since we will need both the clipped and unclipped versions. |
151 } | 154 } |
152 | 155 |
153 template <typename LayerType> | 156 template <typename LayerType> |
154 bool AddTransformNodeIfNeeded( | 157 bool AddTransformNodeIfNeeded( |
155 const DataForRecursion<LayerType>& data_from_ancestor, | 158 const DataForRecursion<LayerType>& data_from_ancestor, |
156 LayerType* layer, | 159 LayerType* layer, |
157 DataForRecursion<LayerType>* data_for_children) { | 160 DataForRecursion<LayerType>* data_for_children) { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 const gfx::Rect& viewport, | 500 const gfx::Rect& viewport, |
498 const gfx::Transform& device_transform, | 501 const gfx::Transform& device_transform, |
499 PropertyTrees* property_trees) { | 502 PropertyTrees* property_trees) { |
500 BuildPropertyTreesTopLevelInternal( | 503 BuildPropertyTreesTopLevelInternal( |
501 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 504 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
502 outer_viewport_scroll_layer, page_scale_factor, device_scale_factor, | 505 outer_viewport_scroll_layer, page_scale_factor, device_scale_factor, |
503 viewport, device_transform, property_trees); | 506 viewport, device_transform, property_trees); |
504 } | 507 } |
505 | 508 |
506 } // namespace cc | 509 } // namespace cc |
OLD | NEW |