| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 template <typename LayerType> | 254 template <typename LayerType> |
| 255 static int GetScrollParentId(const DataForRecursion<LayerType>& data, | 255 static int GetScrollParentId(const DataForRecursion<LayerType>& data, |
| 256 LayerType* layer) { | 256 LayerType* layer) { |
| 257 const bool inherits_scroll = !ScrollParent(layer); | 257 const bool inherits_scroll = !ScrollParent(layer); |
| 258 const int id = inherits_scroll ? data.scroll_tree_parent | 258 const int id = inherits_scroll ? data.scroll_tree_parent |
| 259 : ScrollParent(layer)->scroll_tree_index(); | 259 : ScrollParent(layer)->scroll_tree_index(); |
| 260 return id; | 260 return id; |
| 261 } | 261 } |
| 262 | 262 |
| 263 static Layer* Parent(Layer* layer) { |
| 264 return layer->parent(); |
| 265 } |
| 266 |
| 267 static LayerImpl* Parent(LayerImpl* layer) { |
| 268 return layer->test_properties()->parent; |
| 269 } |
| 270 |
| 263 template <typename LayerType> | 271 template <typename LayerType> |
| 264 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, | 272 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, |
| 265 LayerType* layer, | 273 LayerType* layer, |
| 266 bool created_render_surface, | 274 bool created_render_surface, |
| 267 bool created_transform_node, | 275 bool created_transform_node, |
| 268 DataForRecursion<LayerType>* data_for_children) { | 276 DataForRecursion<LayerType>* data_for_children) { |
| 269 ClipNode* parent = GetClipParent(data_from_ancestor, layer); | 277 ClipNode* parent = GetClipParent(data_from_ancestor, layer); |
| 270 int parent_id = parent->id; | 278 int parent_id = parent->id; |
| 271 | 279 |
| 272 bool is_root = !layer->parent(); | 280 bool is_root = !Parent(layer); |
| 273 | 281 |
| 274 // Whether we have an ancestor clip that we might need to apply. | 282 // Whether we have an ancestor clip that we might need to apply. |
| 275 bool ancestor_clips_subtree = is_root || parent->data.layers_are_clipped; | 283 bool ancestor_clips_subtree = is_root || parent->data.layers_are_clipped; |
| 276 | 284 |
| 277 bool layers_are_clipped = false; | 285 bool layers_are_clipped = false; |
| 278 bool has_unclipped_surface = false; | 286 bool has_unclipped_surface = false; |
| 279 | 287 |
| 280 if (created_render_surface) { | 288 if (created_render_surface) { |
| 281 // Clips can usually be applied to a surface's descendants simply by | 289 // Clips can usually be applied to a surface's descendants simply by |
| 282 // clipping the surface (or applied implicitly by the surface's bounds). | 290 // clipping the surface (or applied implicitly by the surface's bounds). |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 } | 374 } |
| 367 | 375 |
| 368 layer->SetClipTreeIndex(data_for_children->clip_tree_parent); | 376 layer->SetClipTreeIndex(data_for_children->clip_tree_parent); |
| 369 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the | 377 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the |
| 370 // clip for all children since we may need to draw. We need to figure out a | 378 // clip for all children since we may need to draw. We need to figure out a |
| 371 // better way, since we will need both the clipped and unclipped versions. | 379 // better way, since we will need both the clipped and unclipped versions. |
| 372 } | 380 } |
| 373 | 381 |
| 374 template <typename LayerType> | 382 template <typename LayerType> |
| 375 static inline bool IsAtBoundaryOf3dRenderingContext(LayerType* layer) { | 383 static inline bool IsAtBoundaryOf3dRenderingContext(LayerType* layer) { |
| 376 return layer->parent() | 384 return Parent(layer) |
| 377 ? layer->parent()->sorting_context_id() != | 385 ? Parent(layer)->sorting_context_id() != |
| 378 layer->sorting_context_id() | 386 layer->sorting_context_id() |
| 379 : layer->Is3dSorted(); | 387 : layer->Is3dSorted(); |
| 380 } | 388 } |
| 381 | 389 |
| 382 static inline gfx::Point3F TransformOrigin(Layer* layer) { | 390 static inline gfx::Point3F TransformOrigin(Layer* layer) { |
| 383 return layer->transform_origin(); | 391 return layer->transform_origin(); |
| 384 } | 392 } |
| 385 | 393 |
| 386 static inline gfx::Point3F TransformOrigin(LayerImpl* layer) { | 394 static inline gfx::Point3F TransformOrigin(LayerImpl* layer) { |
| 387 return layer->test_properties()->transform_origin; | 395 return layer->test_properties()->transform_origin; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 402 static inline bool ShouldFlattenTransform(LayerImpl* layer) { | 410 static inline bool ShouldFlattenTransform(LayerImpl* layer) { |
| 403 return layer->test_properties()->should_flatten_transform; | 411 return layer->test_properties()->should_flatten_transform; |
| 404 } | 412 } |
| 405 | 413 |
| 406 template <typename LayerType> | 414 template <typename LayerType> |
| 407 bool AddTransformNodeIfNeeded( | 415 bool AddTransformNodeIfNeeded( |
| 408 const DataForRecursion<LayerType>& data_from_ancestor, | 416 const DataForRecursion<LayerType>& data_from_ancestor, |
| 409 LayerType* layer, | 417 LayerType* layer, |
| 410 bool created_render_surface, | 418 bool created_render_surface, |
| 411 DataForRecursion<LayerType>* data_for_children) { | 419 DataForRecursion<LayerType>* data_for_children) { |
| 412 const bool is_root = !layer->parent(); | 420 const bool is_root = !Parent(layer); |
| 413 const bool is_page_scale_layer = layer == data_from_ancestor.page_scale_layer; | 421 const bool is_page_scale_layer = layer == data_from_ancestor.page_scale_layer; |
| 414 const bool is_overscroll_elasticity_layer = | 422 const bool is_overscroll_elasticity_layer = |
| 415 layer == data_from_ancestor.overscroll_elasticity_layer; | 423 layer == data_from_ancestor.overscroll_elasticity_layer; |
| 416 const bool is_scrollable = layer->scrollable(); | 424 const bool is_scrollable = layer->scrollable(); |
| 417 const bool is_fixed = PositionConstraint(layer).is_fixed_position(); | 425 const bool is_fixed = PositionConstraint(layer).is_fixed_position(); |
| 418 | 426 |
| 419 const bool has_significant_transform = | 427 const bool has_significant_transform = |
| 420 !layer->transform().IsIdentityOr2DTranslation(); | 428 !layer->transform().IsIdentityOr2DTranslation(); |
| 421 | 429 |
| 422 const bool has_potentially_animated_transform = | 430 const bool has_potentially_animated_transform = |
| 423 layer->HasPotentiallyRunningTransformAnimation(); | 431 layer->HasPotentiallyRunningTransformAnimation(); |
| 424 | 432 |
| 425 // A transform node is needed even for a finished animation, since differences | 433 // A transform node is needed even for a finished animation, since differences |
| 426 // in the timing of animation state updates can mean that an animation that's | 434 // in the timing of animation state updates can mean that an animation that's |
| 427 // in the Finished state at tree-building time on the main thread is still in | 435 // in the Finished state at tree-building time on the main thread is still in |
| 428 // the Running state right after commit on the compositor thread. | 436 // the Running state right after commit on the compositor thread. |
| 429 const bool has_any_transform_animation = | 437 const bool has_any_transform_animation = |
| 430 layer->HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM); | 438 layer->HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM); |
| 431 | 439 |
| 432 const bool has_surface = created_render_surface; | 440 const bool has_surface = created_render_surface; |
| 433 | 441 |
| 434 // A transform node is needed to change the render target for subtree when | 442 // A transform node is needed to change the render target for subtree when |
| 435 // a scroll child's render target is different from the scroll parent's render | 443 // a scroll child's render target is different from the scroll parent's render |
| 436 // target. | 444 // target. |
| 437 const bool scroll_child_has_different_target = | 445 const bool scroll_child_has_different_target = |
| 438 ScrollParent(layer) && | 446 ScrollParent(layer) && |
| 439 layer->parent()->effect_tree_index() != | 447 Parent(layer)->effect_tree_index() != |
| 440 ScrollParent(layer)->effect_tree_index(); | 448 ScrollParent(layer)->effect_tree_index(); |
| 441 | 449 |
| 442 const bool is_at_boundary_of_3d_rendering_context = | 450 const bool is_at_boundary_of_3d_rendering_context = |
| 443 IsAtBoundaryOf3dRenderingContext(layer); | 451 IsAtBoundaryOf3dRenderingContext(layer); |
| 444 | 452 |
| 445 bool requires_node = is_root || is_scrollable || has_significant_transform || | 453 bool requires_node = is_root || is_scrollable || has_significant_transform || |
| 446 has_any_transform_animation || has_surface || is_fixed || | 454 has_any_transform_animation || has_surface || is_fixed || |
| 447 is_page_scale_layer || is_overscroll_elasticity_layer || | 455 is_page_scale_layer || is_overscroll_elasticity_layer || |
| 448 scroll_child_has_different_target || | 456 scroll_child_has_different_target || |
| 449 is_at_boundary_of_3d_rendering_context; | 457 is_at_boundary_of_3d_rendering_context; |
| 450 | 458 |
| 451 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); | 459 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); |
| 452 DCHECK(is_root || transform_parent); | 460 DCHECK(is_root || transform_parent); |
| 453 | 461 |
| 454 int parent_index = kRootPropertyTreeNodeId; | 462 int parent_index = kRootPropertyTreeNodeId; |
| 455 if (transform_parent) | 463 if (transform_parent) |
| 456 parent_index = transform_parent->transform_tree_index(); | 464 parent_index = transform_parent->transform_tree_index(); |
| 457 | 465 |
| 458 int source_index = parent_index; | 466 int source_index = parent_index; |
| 459 | 467 |
| 460 gfx::Vector2dF source_offset; | 468 gfx::Vector2dF source_offset; |
| 461 if (transform_parent) { | 469 if (transform_parent) { |
| 462 if (ScrollParent(layer)) { | 470 if (ScrollParent(layer)) { |
| 463 LayerType* source = layer->parent(); | 471 LayerType* source = Parent(layer); |
| 464 source_offset += source->offset_to_transform_parent(); | 472 source_offset += source->offset_to_transform_parent(); |
| 465 source_index = source->transform_tree_index(); | 473 source_index = source->transform_tree_index(); |
| 466 } else if (!is_fixed) { | 474 } else if (!is_fixed) { |
| 467 source_offset = transform_parent->offset_to_transform_parent(); | 475 source_offset = transform_parent->offset_to_transform_parent(); |
| 468 } else { | 476 } else { |
| 469 source_offset = data_from_ancestor.transform_tree_parent | 477 source_offset = data_from_ancestor.transform_tree_parent |
| 470 ->offset_to_transform_parent(); | 478 ->offset_to_transform_parent(); |
| 471 source_index = | 479 source_index = |
| 472 data_from_ancestor.transform_tree_parent->transform_tree_index(); | 480 data_from_ancestor.transform_tree_parent->transform_tree_index(); |
| 473 source_offset -= data_from_ancestor.scroll_snap; | 481 source_offset -= data_from_ancestor.scroll_snap; |
| 474 } | 482 } |
| 475 } | 483 } |
| 476 | 484 |
| 477 if (IsContainerForFixedPositionLayers(layer) || is_root) { | 485 if (IsContainerForFixedPositionLayers(layer) || is_root) { |
| 478 data_for_children->affected_by_inner_viewport_bounds_delta = | 486 data_for_children->affected_by_inner_viewport_bounds_delta = |
| 479 layer == data_from_ancestor.inner_viewport_scroll_layer; | 487 layer == data_from_ancestor.inner_viewport_scroll_layer; |
| 480 data_for_children->affected_by_outer_viewport_bounds_delta = | 488 data_for_children->affected_by_outer_viewport_bounds_delta = |
| 481 layer == data_from_ancestor.outer_viewport_scroll_layer; | 489 layer == data_from_ancestor.outer_viewport_scroll_layer; |
| 482 if (is_scrollable) { | 490 if (is_scrollable) { |
| 483 DCHECK(!is_root); | 491 DCHECK(!is_root); |
| 484 DCHECK(layer->transform().IsIdentity()); | 492 DCHECK(layer->transform().IsIdentity()); |
| 485 data_for_children->transform_fixed_parent = layer->parent(); | 493 data_for_children->transform_fixed_parent = Parent(layer); |
| 486 } else { | 494 } else { |
| 487 data_for_children->transform_fixed_parent = layer; | 495 data_for_children->transform_fixed_parent = layer; |
| 488 } | 496 } |
| 489 } | 497 } |
| 490 data_for_children->transform_tree_parent = layer; | 498 data_for_children->transform_tree_parent = layer; |
| 491 | 499 |
| 492 if (IsContainerForFixedPositionLayers(layer) || is_fixed) | 500 if (IsContainerForFixedPositionLayers(layer) || is_fixed) |
| 493 data_for_children->scroll_snap = gfx::Vector2dF(); | 501 data_for_children->scroll_snap = gfx::Vector2dF(); |
| 494 | 502 |
| 495 if (!requires_node) { | 503 if (!requires_node) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 static inline bool ForceRenderSurface(Layer* layer) { | 671 static inline bool ForceRenderSurface(Layer* layer) { |
| 664 return layer->force_render_surface_for_testing(); | 672 return layer->force_render_surface_for_testing(); |
| 665 } | 673 } |
| 666 | 674 |
| 667 static inline bool ForceRenderSurface(LayerImpl* layer) { | 675 static inline bool ForceRenderSurface(LayerImpl* layer) { |
| 668 return layer->test_properties()->force_render_surface; | 676 return layer->test_properties()->force_render_surface; |
| 669 } | 677 } |
| 670 | 678 |
| 671 template <typename LayerType> | 679 template <typename LayerType> |
| 672 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) { | 680 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) { |
| 673 return layer->Is3dSorted() && layer->parent() && | 681 return layer->Is3dSorted() && Parent(layer) && Parent(layer)->Is3dSorted() && |
| 674 layer->parent()->Is3dSorted() && | 682 (Parent(layer)->sorting_context_id() == layer->sorting_context_id()); |
| 675 (layer->parent()->sorting_context_id() == layer->sorting_context_id()); | |
| 676 } | 683 } |
| 677 | 684 |
| 678 static inline bool IsRootForIsolatedGroup(Layer* layer) { | 685 static inline bool IsRootForIsolatedGroup(Layer* layer) { |
| 679 return layer->is_root_for_isolated_group(); | 686 return layer->is_root_for_isolated_group(); |
| 680 } | 687 } |
| 681 | 688 |
| 682 static inline bool IsRootForIsolatedGroup(LayerImpl* layer) { | 689 static inline bool IsRootForIsolatedGroup(LayerImpl* layer) { |
| 683 return false; | 690 return false; |
| 684 } | 691 } |
| 685 | 692 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 return !layer->test_properties()->copy_requests.empty(); | 740 return !layer->test_properties()->copy_requests.empty(); |
| 734 } | 741 } |
| 735 | 742 |
| 736 template <typename LayerType> | 743 template <typename LayerType> |
| 737 bool ShouldCreateRenderSurface(LayerType* layer, | 744 bool ShouldCreateRenderSurface(LayerType* layer, |
| 738 gfx::Transform current_transform, | 745 gfx::Transform current_transform, |
| 739 bool axis_aligned) { | 746 bool axis_aligned) { |
| 740 const bool preserves_2d_axis_alignment = | 747 const bool preserves_2d_axis_alignment = |
| 741 (current_transform * layer->transform()).Preserves2dAxisAlignment() && | 748 (current_transform * layer->transform()).Preserves2dAxisAlignment() && |
| 742 axis_aligned && layer->AnimationsPreserveAxisAlignment(); | 749 axis_aligned && layer->AnimationsPreserveAxisAlignment(); |
| 743 const bool is_root = !layer->parent(); | 750 const bool is_root = !Parent(layer); |
| 744 if (is_root) | 751 if (is_root) |
| 745 return true; | 752 return true; |
| 746 | 753 |
| 747 // If the layer uses a mask and the layer is not a replica layer. | 754 // If the layer uses a mask and the layer is not a replica layer. |
| 748 // TODO(weiliangc): After slimming paint there won't be replica layers. | 755 // TODO(weiliangc): After slimming paint there won't be replica layers. |
| 749 if (MaskLayer(layer) && ReplicaLayer(layer->parent()) != layer) { | 756 if (MaskLayer(layer) && ReplicaLayer(Parent(layer)) != layer) { |
| 750 return true; | 757 return true; |
| 751 } | 758 } |
| 752 | 759 |
| 753 // If the layer has a reflection. | 760 // If the layer has a reflection. |
| 754 if (ReplicaLayer(layer)) { | 761 if (ReplicaLayer(layer)) { |
| 755 return true; | 762 return true; |
| 756 } | 763 } |
| 757 | 764 |
| 758 // If the layer uses a CSS filter. | 765 // If the layer uses a CSS filter. |
| 759 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) { | 766 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 for (auto& request : layer->test_properties()->copy_requests) | 858 for (auto& request : layer->test_properties()->copy_requests) |
| 852 copy_requests->push_back(std::move(request)); | 859 copy_requests->push_back(std::move(request)); |
| 853 layer->test_properties()->copy_requests.clear(); | 860 layer->test_properties()->copy_requests.clear(); |
| 854 } | 861 } |
| 855 | 862 |
| 856 template <typename LayerType> | 863 template <typename LayerType> |
| 857 bool AddEffectNodeIfNeeded( | 864 bool AddEffectNodeIfNeeded( |
| 858 const DataForRecursion<LayerType>& data_from_ancestor, | 865 const DataForRecursion<LayerType>& data_from_ancestor, |
| 859 LayerType* layer, | 866 LayerType* layer, |
| 860 DataForRecursion<LayerType>* data_for_children) { | 867 DataForRecursion<LayerType>* data_for_children) { |
| 861 const bool is_root = !layer->parent(); | 868 const bool is_root = !Parent(layer); |
| 862 const bool has_transparency = EffectiveOpacity(layer) != 1.f; | 869 const bool has_transparency = EffectiveOpacity(layer) != 1.f; |
| 863 const bool has_potential_opacity_animation = | 870 const bool has_potential_opacity_animation = |
| 864 HasPotentialOpacityAnimation(layer); | 871 HasPotentialOpacityAnimation(layer); |
| 865 const bool should_create_render_surface = ShouldCreateRenderSurface( | 872 const bool should_create_render_surface = ShouldCreateRenderSurface( |
| 866 layer, data_from_ancestor.compound_transform_since_render_target, | 873 layer, data_from_ancestor.compound_transform_since_render_target, |
| 867 data_from_ancestor.axis_align_since_render_target); | 874 data_from_ancestor.axis_align_since_render_target); |
| 868 data_for_children->axis_align_since_render_target &= | 875 data_for_children->axis_align_since_render_target &= |
| 869 layer->AnimationsPreserveAxisAlignment(); | 876 layer->AnimationsPreserveAxisAlignment(); |
| 870 | 877 |
| 871 bool requires_node = is_root || has_transparency || | 878 bool requires_node = is_root || has_transparency || |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 return should_create_render_surface; | 962 return should_create_render_surface; |
| 956 } | 963 } |
| 957 | 964 |
| 958 template <typename LayerType> | 965 template <typename LayerType> |
| 959 void AddScrollNodeIfNeeded( | 966 void AddScrollNodeIfNeeded( |
| 960 const DataForRecursion<LayerType>& data_from_ancestor, | 967 const DataForRecursion<LayerType>& data_from_ancestor, |
| 961 LayerType* layer, | 968 LayerType* layer, |
| 962 DataForRecursion<LayerType>* data_for_children) { | 969 DataForRecursion<LayerType>* data_for_children) { |
| 963 int parent_id = GetScrollParentId(data_from_ancestor, layer); | 970 int parent_id = GetScrollParentId(data_from_ancestor, layer); |
| 964 | 971 |
| 965 bool is_root = !layer->parent(); | 972 bool is_root = !Parent(layer); |
| 966 bool scrollable = layer->scrollable(); | 973 bool scrollable = layer->scrollable(); |
| 967 bool contains_non_fast_scrollable_region = | 974 bool contains_non_fast_scrollable_region = |
| 968 !layer->non_fast_scrollable_region().IsEmpty(); | 975 !layer->non_fast_scrollable_region().IsEmpty(); |
| 969 uint32_t main_thread_scrolling_reasons = | 976 uint32_t main_thread_scrolling_reasons = |
| 970 layer->main_thread_scrolling_reasons(); | 977 layer->main_thread_scrolling_reasons(); |
| 971 | 978 |
| 972 bool scroll_node_uninheritable_criteria = | 979 bool scroll_node_uninheritable_criteria = |
| 973 is_root || scrollable || contains_non_fast_scrollable_region; | 980 is_root || scrollable || contains_non_fast_scrollable_region; |
| 974 bool has_different_main_thread_scrolling_reasons = | 981 bool has_different_main_thread_scrolling_reasons = |
| 975 main_thread_scrolling_reasons != | 982 main_thread_scrolling_reasons != |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 layer->SetScrollTreeIndex(data_for_children->scroll_tree_parent); | 1044 layer->SetScrollTreeIndex(data_for_children->scroll_tree_parent); |
| 1038 } | 1045 } |
| 1039 | 1046 |
| 1040 template <typename LayerType> | 1047 template <typename LayerType> |
| 1041 void SetBackfaceVisibilityTransform(LayerType* layer, | 1048 void SetBackfaceVisibilityTransform(LayerType* layer, |
| 1042 bool created_transform_node) { | 1049 bool created_transform_node) { |
| 1043 const bool is_at_boundary_of_3d_rendering_context = | 1050 const bool is_at_boundary_of_3d_rendering_context = |
| 1044 IsAtBoundaryOf3dRenderingContext(layer); | 1051 IsAtBoundaryOf3dRenderingContext(layer); |
| 1045 if (layer->use_parent_backface_visibility()) { | 1052 if (layer->use_parent_backface_visibility()) { |
| 1046 DCHECK(!is_at_boundary_of_3d_rendering_context); | 1053 DCHECK(!is_at_boundary_of_3d_rendering_context); |
| 1047 DCHECK(layer->parent()); | 1054 DCHECK(Parent(layer)); |
| 1048 DCHECK(!layer->parent()->use_parent_backface_visibility()); | 1055 DCHECK(!Parent(layer)->use_parent_backface_visibility()); |
| 1049 layer->SetUseLocalTransformForBackfaceVisibility( | 1056 layer->SetUseLocalTransformForBackfaceVisibility( |
| 1050 layer->parent()->use_local_transform_for_backface_visibility()); | 1057 Parent(layer)->use_local_transform_for_backface_visibility()); |
| 1051 layer->SetShouldCheckBackfaceVisibility( | 1058 layer->SetShouldCheckBackfaceVisibility( |
| 1052 layer->parent()->should_check_backface_visibility()); | 1059 Parent(layer)->should_check_backface_visibility()); |
| 1053 } else { | 1060 } else { |
| 1054 // The current W3C spec on CSS transforms says that backface visibility | 1061 // The current W3C spec on CSS transforms says that backface visibility |
| 1055 // should be determined differently depending on whether the layer is in a | 1062 // should be determined differently depending on whether the layer is in a |
| 1056 // "3d rendering context" or not. For Chromium code, we can determine | 1063 // "3d rendering context" or not. For Chromium code, we can determine |
| 1057 // whether we are in a 3d rendering context by checking if the parent | 1064 // whether we are in a 3d rendering context by checking if the parent |
| 1058 // preserves 3d. | 1065 // preserves 3d. |
| 1059 const bool use_local_transform = | 1066 const bool use_local_transform = |
| 1060 !layer->Is3dSorted() || | 1067 !layer->Is3dSorted() || |
| 1061 (layer->Is3dSorted() && is_at_boundary_of_3d_rendering_context); | 1068 (layer->Is3dSorted() && is_at_boundary_of_3d_rendering_context); |
| 1062 layer->SetUseLocalTransformForBackfaceVisibility(use_local_transform); | 1069 layer->SetUseLocalTransformForBackfaceVisibility(use_local_transform); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 // The child should be included in its scroll parent's list of scroll | 1145 // The child should be included in its scroll parent's list of scroll |
| 1139 // children. | 1146 // children. |
| 1140 DCHECK(ScrollChildren(ScrollParent(current_child))->count(current_child)); | 1147 DCHECK(ScrollChildren(ScrollParent(current_child))->count(current_child)); |
| 1141 } | 1148 } |
| 1142 } | 1149 } |
| 1143 | 1150 |
| 1144 if (ScrollChildren(layer)) { | 1151 if (ScrollChildren(layer)) { |
| 1145 for (LayerType* scroll_child : *ScrollChildren(layer)) { | 1152 for (LayerType* scroll_child : *ScrollChildren(layer)) { |
| 1146 DCHECK_EQ(ScrollParent(scroll_child), layer); | 1153 DCHECK_EQ(ScrollParent(scroll_child), layer); |
| 1147 DataForRecursionFromChild<LayerType> data_from_child; | 1154 DataForRecursionFromChild<LayerType> data_from_child; |
| 1148 DCHECK(scroll_child->parent()); | 1155 DCHECK(Parent(scroll_child)); |
| 1149 data_for_children.effect_tree_parent = | 1156 data_for_children.effect_tree_parent = |
| 1150 scroll_child->parent()->effect_tree_index(); | 1157 Parent(scroll_child)->effect_tree_index(); |
| 1151 data_for_children.render_target = | 1158 data_for_children.render_target = |
| 1152 scroll_child->parent()->effect_tree_index(); | 1159 Parent(scroll_child)->effect_tree_index(); |
| 1153 BuildPropertyTreesInternal(scroll_child, data_for_children, | 1160 BuildPropertyTreesInternal(scroll_child, data_for_children, |
| 1154 &data_from_child); | 1161 &data_from_child); |
| 1155 data_to_parent->Merge(data_from_child); | 1162 data_to_parent->Merge(data_from_child); |
| 1156 } | 1163 } |
| 1157 } | 1164 } |
| 1158 | 1165 |
| 1159 if (ReplicaLayer(layer)) { | 1166 if (ReplicaLayer(layer)) { |
| 1160 DataForRecursionFromChild<LayerType> data_from_child; | 1167 DataForRecursionFromChild<LayerType> data_from_child; |
| 1161 BuildPropertyTreesInternal(ReplicaLayer(layer), data_for_children, | 1168 BuildPropertyTreesInternal(ReplicaLayer(layer), data_for_children, |
| 1162 &data_from_child); | 1169 &data_from_child); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 if (SkColorGetA(color) != 255) | 1381 if (SkColorGetA(color) != 255) |
| 1375 color = SkColorSetA(color, 255); | 1382 color = SkColorSetA(color, 255); |
| 1376 BuildPropertyTreesTopLevelInternal( | 1383 BuildPropertyTreesTopLevelInternal( |
| 1377 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1384 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1378 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1385 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1379 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1386 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1380 device_transform, property_trees, color); | 1387 device_transform, property_trees, color); |
| 1381 } | 1388 } |
| 1382 | 1389 |
| 1383 } // namespace cc | 1390 } // namespace cc |
| OLD | NEW |