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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 530 IsAtBoundaryOf3dRenderingContext(layer); | 530 IsAtBoundaryOf3dRenderingContext(layer); |
| 531 | 531 |
| 532 DCHECK(!is_scrollable || is_snapped); | 532 DCHECK(!is_scrollable || is_snapped); |
| 533 bool requires_node = is_root || is_snapped || has_significant_transform || | 533 bool requires_node = is_root || is_snapped || has_significant_transform || |
| 534 has_any_transform_animation || has_surface || is_fixed || | 534 has_any_transform_animation || has_surface || is_fixed || |
| 535 is_page_scale_layer || is_overscroll_elasticity_layer || | 535 is_page_scale_layer || is_overscroll_elasticity_layer || |
| 536 has_proxied_transform_related_property || | 536 has_proxied_transform_related_property || |
| 537 scroll_child_has_different_target || is_sticky || | 537 scroll_child_has_different_target || is_sticky || |
| 538 is_at_boundary_of_3d_rendering_context; | 538 is_at_boundary_of_3d_rendering_context; |
| 539 | 539 |
| 540 int parent_index = TransformTree::kRootNodeId; | |
| 541 int source_index = parent_index; | |
|
weiliangc
2017/03/31 17:44:48
nit: I think it's cleaner if source_index is initi
smcgruer
2017/03/31 17:48:15
Done.
| |
| 542 gfx::Vector2dF source_offset; | |
| 543 | |
| 540 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); | 544 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); |
| 541 DCHECK(is_root || transform_parent); | 545 DCHECK_EQ(is_root, !transform_parent); |
| 542 | 546 |
| 543 int parent_index = TransformTree::kRootNodeId; | 547 if (transform_parent) { |
| 544 if (transform_parent) | |
| 545 parent_index = transform_parent->transform_tree_index(); | 548 parent_index = transform_parent->transform_tree_index(); |
| 546 | 549 // Because Blink still provides positions with respect to the parent layer, |
| 547 int source_index = parent_index; | 550 // we track both a parent TransformNode (which is the parent in the |
| 548 | 551 // TransformTree) and a 'source' TransformNode (which is the TransformNode |
| 549 gfx::Vector2dF source_offset; | 552 // for the parent in the Layer tree). |
| 550 if (transform_parent) { | 553 source_index = Parent(layer)->transform_tree_index(); |
| 551 if (ScrollParent(layer)) { | 554 source_offset = Parent(layer)->offset_to_transform_parent(); |
| 552 LayerType* source = Parent(layer); | |
| 553 source_offset += source->offset_to_transform_parent(); | |
| 554 source_index = source->transform_tree_index(); | |
| 555 } else if (!is_fixed) { | |
| 556 source_offset = transform_parent->offset_to_transform_parent(); | |
| 557 } else { | |
| 558 source_offset = data_from_ancestor.transform_tree_parent | |
| 559 ->offset_to_transform_parent(); | |
| 560 source_index = | |
| 561 data_from_ancestor.transform_tree_parent->transform_tree_index(); | |
| 562 } | |
| 563 } | 555 } |
| 564 | 556 |
| 565 if (IsContainerForFixedPositionLayers(layer) || is_root) { | 557 if (IsContainerForFixedPositionLayers(layer) || is_root) { |
| 566 data_for_children->affected_by_inner_viewport_bounds_delta = | 558 data_for_children->affected_by_inner_viewport_bounds_delta = |
| 567 layer == data_from_ancestor.inner_viewport_scroll_layer; | 559 layer == data_from_ancestor.inner_viewport_scroll_layer; |
| 568 data_for_children->affected_by_outer_viewport_bounds_delta = | 560 data_for_children->affected_by_outer_viewport_bounds_delta = |
| 569 layer == data_from_ancestor.outer_viewport_scroll_layer; | 561 layer == data_from_ancestor.outer_viewport_scroll_layer; |
| 570 if (is_scrollable) { | 562 if (is_scrollable) { |
| 571 DCHECK(!is_root); | 563 DCHECK(!is_root); |
| 572 DCHECK(Transform(layer).IsIdentity()); | 564 DCHECK(Transform(layer).IsIdentity()); |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1532 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1524 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1533 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1525 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1534 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1526 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1535 device_transform, property_trees, color); | 1527 device_transform, property_trees, color); |
| 1536 property_trees->effect_tree.CreateOrReuseRenderSurfaces( | 1528 property_trees->effect_tree.CreateOrReuseRenderSurfaces( |
| 1537 &render_surfaces, root_layer->layer_tree_impl()); | 1529 &render_surfaces, root_layer->layer_tree_impl()); |
| 1538 property_trees->ResetCachedData(); | 1530 property_trees->ResetCachedData(); |
| 1539 } | 1531 } |
| 1540 | 1532 |
| 1541 } // namespace cc | 1533 } // namespace cc |
| OLD | NEW |