| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 const bool has_surface = created_render_surface; | 225 const bool has_surface = created_render_surface; |
| 226 | 226 |
| 227 // A transform node is needed to change the render target for subtree when | 227 // A transform node is needed to change the render target for subtree when |
| 228 // a scroll child's render target is different from the scroll parent's render | 228 // a scroll child's render target is different from the scroll parent's render |
| 229 // target. | 229 // target. |
| 230 const bool scroll_child_has_different_target = | 230 const bool scroll_child_has_different_target = |
| 231 layer->scroll_parent() && | 231 layer->scroll_parent() && |
| 232 layer->parent()->effect_tree_index() != | 232 layer->parent()->effect_tree_index() != |
| 233 layer->scroll_parent()->effect_tree_index(); | 233 layer->scroll_parent()->effect_tree_index(); |
| 234 | 234 |
| 235 const bool is_at_boundary_of_3d_rendering_context = |
| 236 layer->parent() |
| 237 ? layer->parent()->sorting_context_id() != layer->sorting_context_id() |
| 238 : layer->Is3dSorted(); |
| 235 bool requires_node = is_root || is_scrollable || has_significant_transform || | 239 bool requires_node = is_root || is_scrollable || has_significant_transform || |
| 236 has_any_transform_animation || has_surface || is_fixed || | 240 has_any_transform_animation || has_surface || is_fixed || |
| 237 is_page_scale_layer || is_overscroll_elasticity_layer || | 241 is_page_scale_layer || is_overscroll_elasticity_layer || |
| 238 scroll_child_has_different_target; | 242 scroll_child_has_different_target || |
| 243 is_at_boundary_of_3d_rendering_context; |
| 239 | 244 |
| 240 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); | 245 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); |
| 241 DCHECK(is_root || transform_parent); | 246 DCHECK(is_root || transform_parent); |
| 242 | 247 |
| 243 int parent_index = kRootPropertyTreeNodeId; | 248 int parent_index = kRootPropertyTreeNodeId; |
| 244 if (transform_parent) | 249 if (transform_parent) |
| 245 parent_index = transform_parent->transform_tree_index(); | 250 parent_index = transform_parent->transform_tree_index(); |
| 246 | 251 |
| 247 int source_index = parent_index; | 252 int source_index = parent_index; |
| 248 | 253 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 data_for_children->transform_tree->Insert(TransformNode(), parent_index); | 310 data_for_children->transform_tree->Insert(TransformNode(), parent_index); |
| 306 | 311 |
| 307 TransformNode* node = data_for_children->transform_tree->back(); | 312 TransformNode* node = data_for_children->transform_tree->back(); |
| 308 layer->SetTransformTreeIndex(node->id); | 313 layer->SetTransformTreeIndex(node->id); |
| 309 if (layer->mask_layer()) | 314 if (layer->mask_layer()) |
| 310 layer->mask_layer()->SetTransformTreeIndex(node->id); | 315 layer->mask_layer()->SetTransformTreeIndex(node->id); |
| 311 | 316 |
| 312 node->data.scrolls = is_scrollable; | 317 node->data.scrolls = is_scrollable; |
| 313 node->data.flattens_inherited_transform = data_for_children->should_flatten; | 318 node->data.flattens_inherited_transform = data_for_children->should_flatten; |
| 314 | 319 |
| 320 node->data.sorting_context_id = layer->sorting_context_id(); |
| 321 |
| 315 if (layer == data_from_ancestor.page_scale_layer) | 322 if (layer == data_from_ancestor.page_scale_layer) |
| 316 data_for_children->in_subtree_of_page_scale_layer = true; | 323 data_for_children->in_subtree_of_page_scale_layer = true; |
| 317 node->data.in_subtree_of_page_scale_layer = | 324 node->data.in_subtree_of_page_scale_layer = |
| 318 data_for_children->in_subtree_of_page_scale_layer; | 325 data_for_children->in_subtree_of_page_scale_layer; |
| 319 | 326 |
| 320 // Surfaces inherently flatten transforms. | 327 // Surfaces inherently flatten transforms. |
| 321 data_for_children->should_flatten = | 328 data_for_children->should_flatten = |
| 322 layer->should_flatten_transform() || has_surface; | 329 layer->should_flatten_transform() || has_surface; |
| 323 DCHECK_GT(data_from_ancestor.effect_tree->size(), 0u); | 330 DCHECK_GT(data_from_ancestor.effect_tree->size(), 0u); |
| 324 | 331 |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 const gfx::Transform& device_transform, | 812 const gfx::Transform& device_transform, |
| 806 PropertyTrees* property_trees) { | 813 PropertyTrees* property_trees) { |
| 807 BuildPropertyTreesTopLevelInternal( | 814 BuildPropertyTreesTopLevelInternal( |
| 808 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 815 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 809 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 816 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 810 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 817 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 811 device_transform, property_trees); | 818 device_transform, property_trees); |
| 812 } | 819 } |
| 813 | 820 |
| 814 } // namespace cc | 821 } // namespace cc |
| OLD | NEW |