| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 template <typename LayerType> | 238 template <typename LayerType> |
| 239 static int GetScrollParentId(const DataForRecursion<LayerType>& data, | 239 static int GetScrollParentId(const DataForRecursion<LayerType>& data, |
| 240 LayerType* layer) { | 240 LayerType* layer) { |
| 241 const bool inherits_scroll = !ScrollParent(layer); | 241 const bool inherits_scroll = !ScrollParent(layer); |
| 242 const int id = inherits_scroll ? data.scroll_tree_parent | 242 const int id = inherits_scroll ? data.scroll_tree_parent |
| 243 : ScrollParent(layer)->scroll_tree_index(); | 243 : ScrollParent(layer)->scroll_tree_index(); |
| 244 return id; | 244 return id; |
| 245 } | 245 } |
| 246 | 246 |
| 247 static Layer* Parent(Layer* layer) { |
| 248 return layer->parent(); |
| 249 } |
| 250 |
| 251 static LayerImpl* Parent(LayerImpl* layer) { |
| 252 return layer->test_properties()->parent; |
| 253 } |
| 254 |
| 247 template <typename LayerType> | 255 template <typename LayerType> |
| 248 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, | 256 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, |
| 249 LayerType* layer, | 257 LayerType* layer, |
| 250 bool created_render_surface, | 258 bool created_render_surface, |
| 251 bool created_transform_node, | 259 bool created_transform_node, |
| 252 DataForRecursion<LayerType>* data_for_children) { | 260 DataForRecursion<LayerType>* data_for_children) { |
| 253 ClipNode* parent = GetClipParent(data_from_ancestor, layer); | 261 ClipNode* parent = GetClipParent(data_from_ancestor, layer); |
| 254 int parent_id = parent->id; | 262 int parent_id = parent->id; |
| 255 | 263 |
| 256 bool is_root = !layer->parent(); | 264 bool is_root = !Parent(layer); |
| 257 | 265 |
| 258 // Whether we have an ancestor clip that we might need to apply. | 266 // Whether we have an ancestor clip that we might need to apply. |
| 259 bool ancestor_clips_subtree = is_root || parent->data.layers_are_clipped; | 267 bool ancestor_clips_subtree = is_root || parent->data.layers_are_clipped; |
| 260 | 268 |
| 261 bool layers_are_clipped = false; | 269 bool layers_are_clipped = false; |
| 262 bool has_unclipped_surface = false; | 270 bool has_unclipped_surface = false; |
| 263 | 271 |
| 264 if (created_render_surface) { | 272 if (created_render_surface) { |
| 265 // Clips can usually be applied to a surface's descendants simply by | 273 // Clips can usually be applied to a surface's descendants simply by |
| 266 // clipping the surface (or applied implicitly by the surface's bounds). | 274 // clipping the surface (or applied implicitly by the surface's bounds). |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 358 } |
| 351 | 359 |
| 352 layer->SetClipTreeIndex(data_for_children->clip_tree_parent); | 360 layer->SetClipTreeIndex(data_for_children->clip_tree_parent); |
| 353 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the | 361 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the |
| 354 // clip for all children since we may need to draw. We need to figure out a | 362 // clip for all children since we may need to draw. We need to figure out a |
| 355 // better way, since we will need both the clipped and unclipped versions. | 363 // better way, since we will need both the clipped and unclipped versions. |
| 356 } | 364 } |
| 357 | 365 |
| 358 template <typename LayerType> | 366 template <typename LayerType> |
| 359 static inline bool IsAtBoundaryOf3dRenderingContext(LayerType* layer) { | 367 static inline bool IsAtBoundaryOf3dRenderingContext(LayerType* layer) { |
| 360 return layer->parent() | 368 return Parent(layer) |
| 361 ? layer->parent()->sorting_context_id() != | 369 ? Parent(layer)->sorting_context_id() != |
| 362 layer->sorting_context_id() | 370 layer->sorting_context_id() |
| 363 : layer->Is3dSorted(); | 371 : layer->Is3dSorted(); |
| 364 } | 372 } |
| 365 | 373 |
| 366 static inline gfx::Point3F TransformOrigin(Layer* layer) { | 374 static inline gfx::Point3F TransformOrigin(Layer* layer) { |
| 367 return layer->transform_origin(); | 375 return layer->transform_origin(); |
| 368 } | 376 } |
| 369 | 377 |
| 370 static inline gfx::Point3F TransformOrigin(LayerImpl* layer) { | 378 static inline gfx::Point3F TransformOrigin(LayerImpl* layer) { |
| 371 return layer->test_properties()->transform_origin; | 379 return layer->test_properties()->transform_origin; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 386 static inline bool ShouldFlattenTransform(LayerImpl* layer) { | 394 static inline bool ShouldFlattenTransform(LayerImpl* layer) { |
| 387 return layer->test_properties()->should_flatten_transform; | 395 return layer->test_properties()->should_flatten_transform; |
| 388 } | 396 } |
| 389 | 397 |
| 390 template <typename LayerType> | 398 template <typename LayerType> |
| 391 bool AddTransformNodeIfNeeded( | 399 bool AddTransformNodeIfNeeded( |
| 392 const DataForRecursion<LayerType>& data_from_ancestor, | 400 const DataForRecursion<LayerType>& data_from_ancestor, |
| 393 LayerType* layer, | 401 LayerType* layer, |
| 394 bool created_render_surface, | 402 bool created_render_surface, |
| 395 DataForRecursion<LayerType>* data_for_children) { | 403 DataForRecursion<LayerType>* data_for_children) { |
| 396 const bool is_root = !layer->parent(); | 404 const bool is_root = !Parent(layer); |
| 397 const bool is_page_scale_layer = layer == data_from_ancestor.page_scale_layer; | 405 const bool is_page_scale_layer = layer == data_from_ancestor.page_scale_layer; |
| 398 const bool is_overscroll_elasticity_layer = | 406 const bool is_overscroll_elasticity_layer = |
| 399 layer == data_from_ancestor.overscroll_elasticity_layer; | 407 layer == data_from_ancestor.overscroll_elasticity_layer; |
| 400 const bool is_scrollable = layer->scrollable(); | 408 const bool is_scrollable = layer->scrollable(); |
| 401 const bool is_fixed = PositionConstraint(layer).is_fixed_position(); | 409 const bool is_fixed = PositionConstraint(layer).is_fixed_position(); |
| 402 | 410 |
| 403 const bool has_significant_transform = | 411 const bool has_significant_transform = |
| 404 !layer->transform().IsIdentityOr2DTranslation(); | 412 !layer->transform().IsIdentityOr2DTranslation(); |
| 405 | 413 |
| 406 const bool has_potentially_animated_transform = | 414 const bool has_potentially_animated_transform = |
| 407 layer->HasPotentiallyRunningTransformAnimation(); | 415 layer->HasPotentiallyRunningTransformAnimation(); |
| 408 | 416 |
| 409 // A transform node is needed even for a finished animation, since differences | 417 // A transform node is needed even for a finished animation, since differences |
| 410 // in the timing of animation state updates can mean that an animation that's | 418 // in the timing of animation state updates can mean that an animation that's |
| 411 // in the Finished state at tree-building time on the main thread is still in | 419 // in the Finished state at tree-building time on the main thread is still in |
| 412 // the Running state right after commit on the compositor thread. | 420 // the Running state right after commit on the compositor thread. |
| 413 const bool has_any_transform_animation = | 421 const bool has_any_transform_animation = |
| 414 layer->HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM); | 422 layer->HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM); |
| 415 | 423 |
| 416 const bool has_surface = created_render_surface; | 424 const bool has_surface = created_render_surface; |
| 417 | 425 |
| 418 // A transform node is needed to change the render target for subtree when | 426 // A transform node is needed to change the render target for subtree when |
| 419 // a scroll child's render target is different from the scroll parent's render | 427 // a scroll child's render target is different from the scroll parent's render |
| 420 // target. | 428 // target. |
| 421 const bool scroll_child_has_different_target = | 429 const bool scroll_child_has_different_target = |
| 422 ScrollParent(layer) && | 430 ScrollParent(layer) && |
| 423 layer->parent()->effect_tree_index() != | 431 Parent(layer)->effect_tree_index() != |
| 424 ScrollParent(layer)->effect_tree_index(); | 432 ScrollParent(layer)->effect_tree_index(); |
| 425 | 433 |
| 426 const bool is_at_boundary_of_3d_rendering_context = | 434 const bool is_at_boundary_of_3d_rendering_context = |
| 427 IsAtBoundaryOf3dRenderingContext(layer); | 435 IsAtBoundaryOf3dRenderingContext(layer); |
| 428 | 436 |
| 429 bool requires_node = is_root || is_scrollable || has_significant_transform || | 437 bool requires_node = is_root || is_scrollable || has_significant_transform || |
| 430 has_any_transform_animation || has_surface || is_fixed || | 438 has_any_transform_animation || has_surface || is_fixed || |
| 431 is_page_scale_layer || is_overscroll_elasticity_layer || | 439 is_page_scale_layer || is_overscroll_elasticity_layer || |
| 432 scroll_child_has_different_target || | 440 scroll_child_has_different_target || |
| 433 is_at_boundary_of_3d_rendering_context; | 441 is_at_boundary_of_3d_rendering_context; |
| 434 | 442 |
| 435 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); | 443 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); |
| 436 DCHECK(is_root || transform_parent); | 444 DCHECK(is_root || transform_parent); |
| 437 | 445 |
| 438 int parent_index = kRootPropertyTreeNodeId; | 446 int parent_index = kRootPropertyTreeNodeId; |
| 439 if (transform_parent) | 447 if (transform_parent) |
| 440 parent_index = transform_parent->transform_tree_index(); | 448 parent_index = transform_parent->transform_tree_index(); |
| 441 | 449 |
| 442 int source_index = parent_index; | 450 int source_index = parent_index; |
| 443 | 451 |
| 444 gfx::Vector2dF source_offset; | 452 gfx::Vector2dF source_offset; |
| 445 if (transform_parent) { | 453 if (transform_parent) { |
| 446 if (ScrollParent(layer)) { | 454 if (ScrollParent(layer)) { |
| 447 LayerType* source = layer->parent(); | 455 LayerType* source = Parent(layer); |
| 448 source_offset += source->offset_to_transform_parent(); | 456 source_offset += source->offset_to_transform_parent(); |
| 449 source_index = source->transform_tree_index(); | 457 source_index = source->transform_tree_index(); |
| 450 } else if (!is_fixed) { | 458 } else if (!is_fixed) { |
| 451 source_offset = transform_parent->offset_to_transform_parent(); | 459 source_offset = transform_parent->offset_to_transform_parent(); |
| 452 } else { | 460 } else { |
| 453 source_offset = data_from_ancestor.transform_tree_parent | 461 source_offset = data_from_ancestor.transform_tree_parent |
| 454 ->offset_to_transform_parent(); | 462 ->offset_to_transform_parent(); |
| 455 source_index = | 463 source_index = |
| 456 data_from_ancestor.transform_tree_parent->transform_tree_index(); | 464 data_from_ancestor.transform_tree_parent->transform_tree_index(); |
| 457 source_offset -= data_from_ancestor.scroll_snap; | 465 source_offset -= data_from_ancestor.scroll_snap; |
| 458 } | 466 } |
| 459 } | 467 } |
| 460 | 468 |
| 461 if (IsContainerForFixedPositionLayers(layer) || is_root) { | 469 if (IsContainerForFixedPositionLayers(layer) || is_root) { |
| 462 data_for_children->affected_by_inner_viewport_bounds_delta = | 470 data_for_children->affected_by_inner_viewport_bounds_delta = |
| 463 layer == data_from_ancestor.inner_viewport_scroll_layer; | 471 layer == data_from_ancestor.inner_viewport_scroll_layer; |
| 464 data_for_children->affected_by_outer_viewport_bounds_delta = | 472 data_for_children->affected_by_outer_viewport_bounds_delta = |
| 465 layer == data_from_ancestor.outer_viewport_scroll_layer; | 473 layer == data_from_ancestor.outer_viewport_scroll_layer; |
| 466 if (is_scrollable) { | 474 if (is_scrollable) { |
| 467 DCHECK(!is_root); | 475 DCHECK(!is_root); |
| 468 DCHECK(layer->transform().IsIdentity()); | 476 DCHECK(layer->transform().IsIdentity()); |
| 469 data_for_children->transform_fixed_parent = layer->parent(); | 477 data_for_children->transform_fixed_parent = Parent(layer); |
| 470 } else { | 478 } else { |
| 471 data_for_children->transform_fixed_parent = layer; | 479 data_for_children->transform_fixed_parent = layer; |
| 472 } | 480 } |
| 473 } | 481 } |
| 474 data_for_children->transform_tree_parent = layer; | 482 data_for_children->transform_tree_parent = layer; |
| 475 | 483 |
| 476 if (IsContainerForFixedPositionLayers(layer) || is_fixed) | 484 if (IsContainerForFixedPositionLayers(layer) || is_fixed) |
| 477 data_for_children->scroll_snap = gfx::Vector2dF(); | 485 data_for_children->scroll_snap = gfx::Vector2dF(); |
| 478 | 486 |
| 479 if (!requires_node) { | 487 if (!requires_node) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 static inline bool ForceRenderSurface(Layer* layer) { | 655 static inline bool ForceRenderSurface(Layer* layer) { |
| 648 return layer->force_render_surface_for_testing(); | 656 return layer->force_render_surface_for_testing(); |
| 649 } | 657 } |
| 650 | 658 |
| 651 static inline bool ForceRenderSurface(LayerImpl* layer) { | 659 static inline bool ForceRenderSurface(LayerImpl* layer) { |
| 652 return layer->test_properties()->force_render_surface; | 660 return layer->test_properties()->force_render_surface; |
| 653 } | 661 } |
| 654 | 662 |
| 655 template <typename LayerType> | 663 template <typename LayerType> |
| 656 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) { | 664 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) { |
| 657 return layer->Is3dSorted() && layer->parent() && | 665 return layer->Is3dSorted() && Parent(layer) && Parent(layer)->Is3dSorted() && |
| 658 layer->parent()->Is3dSorted() && | 666 (Parent(layer)->sorting_context_id() == layer->sorting_context_id()); |
| 659 (layer->parent()->sorting_context_id() == layer->sorting_context_id()); | |
| 660 } | 667 } |
| 661 | 668 |
| 662 static inline bool IsRootForIsolatedGroup(Layer* layer) { | 669 static inline bool IsRootForIsolatedGroup(Layer* layer) { |
| 663 return layer->is_root_for_isolated_group(); | 670 return layer->is_root_for_isolated_group(); |
| 664 } | 671 } |
| 665 | 672 |
| 666 static inline bool IsRootForIsolatedGroup(LayerImpl* layer) { | 673 static inline bool IsRootForIsolatedGroup(LayerImpl* layer) { |
| 667 return false; | 674 return false; |
| 668 } | 675 } |
| 669 | 676 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 return !layer->test_properties()->copy_requests.empty(); | 724 return !layer->test_properties()->copy_requests.empty(); |
| 718 } | 725 } |
| 719 | 726 |
| 720 template <typename LayerType> | 727 template <typename LayerType> |
| 721 bool ShouldCreateRenderSurface(LayerType* layer, | 728 bool ShouldCreateRenderSurface(LayerType* layer, |
| 722 gfx::Transform current_transform, | 729 gfx::Transform current_transform, |
| 723 bool axis_aligned) { | 730 bool axis_aligned) { |
| 724 const bool preserves_2d_axis_alignment = | 731 const bool preserves_2d_axis_alignment = |
| 725 (current_transform * layer->transform()).Preserves2dAxisAlignment() && | 732 (current_transform * layer->transform()).Preserves2dAxisAlignment() && |
| 726 axis_aligned && layer->AnimationsPreserveAxisAlignment(); | 733 axis_aligned && layer->AnimationsPreserveAxisAlignment(); |
| 727 const bool is_root = !layer->parent(); | 734 const bool is_root = !Parent(layer); |
| 728 if (is_root) | 735 if (is_root) |
| 729 return true; | 736 return true; |
| 730 | 737 |
| 731 // If the layer uses a mask and the layer is not a replica layer. | 738 // If the layer uses a mask and the layer is not a replica layer. |
| 732 // TODO(weiliangc): After slimming paint there won't be replica layers. | 739 // TODO(weiliangc): After slimming paint there won't be replica layers. |
| 733 if (layer->mask_layer() && layer->parent()->replica_layer() != layer) { | 740 if (layer->mask_layer() && Parent(layer)->replica_layer() != layer) { |
| 734 return true; | 741 return true; |
| 735 } | 742 } |
| 736 | 743 |
| 737 // If the layer has a reflection. | 744 // If the layer has a reflection. |
| 738 if (layer->replica_layer()) { | 745 if (layer->replica_layer()) { |
| 739 return true; | 746 return true; |
| 740 } | 747 } |
| 741 | 748 |
| 742 // If the layer uses a CSS filter. | 749 // If the layer uses a CSS filter. |
| 743 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) { | 750 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 for (auto& request : layer->test_properties()->copy_requests) | 842 for (auto& request : layer->test_properties()->copy_requests) |
| 836 copy_requests->push_back(std::move(request)); | 843 copy_requests->push_back(std::move(request)); |
| 837 layer->test_properties()->copy_requests.clear(); | 844 layer->test_properties()->copy_requests.clear(); |
| 838 } | 845 } |
| 839 | 846 |
| 840 template <typename LayerType> | 847 template <typename LayerType> |
| 841 bool AddEffectNodeIfNeeded( | 848 bool AddEffectNodeIfNeeded( |
| 842 const DataForRecursion<LayerType>& data_from_ancestor, | 849 const DataForRecursion<LayerType>& data_from_ancestor, |
| 843 LayerType* layer, | 850 LayerType* layer, |
| 844 DataForRecursion<LayerType>* data_for_children) { | 851 DataForRecursion<LayerType>* data_for_children) { |
| 845 const bool is_root = !layer->parent(); | 852 const bool is_root = !Parent(layer); |
| 846 const bool has_transparency = EffectiveOpacity(layer) != 1.f; | 853 const bool has_transparency = EffectiveOpacity(layer) != 1.f; |
| 847 const bool has_potential_opacity_animation = | 854 const bool has_potential_opacity_animation = |
| 848 HasPotentialOpacityAnimation(layer); | 855 HasPotentialOpacityAnimation(layer); |
| 849 const bool should_create_render_surface = ShouldCreateRenderSurface( | 856 const bool should_create_render_surface = ShouldCreateRenderSurface( |
| 850 layer, data_from_ancestor.compound_transform_since_render_target, | 857 layer, data_from_ancestor.compound_transform_since_render_target, |
| 851 data_from_ancestor.axis_align_since_render_target); | 858 data_from_ancestor.axis_align_since_render_target); |
| 852 data_for_children->axis_align_since_render_target &= | 859 data_for_children->axis_align_since_render_target &= |
| 853 layer->AnimationsPreserveAxisAlignment(); | 860 layer->AnimationsPreserveAxisAlignment(); |
| 854 | 861 |
| 855 bool requires_node = is_root || has_transparency || | 862 bool requires_node = is_root || has_transparency || |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 return should_create_render_surface; | 934 return should_create_render_surface; |
| 928 } | 935 } |
| 929 | 936 |
| 930 template <typename LayerType> | 937 template <typename LayerType> |
| 931 void AddScrollNodeIfNeeded( | 938 void AddScrollNodeIfNeeded( |
| 932 const DataForRecursion<LayerType>& data_from_ancestor, | 939 const DataForRecursion<LayerType>& data_from_ancestor, |
| 933 LayerType* layer, | 940 LayerType* layer, |
| 934 DataForRecursion<LayerType>* data_for_children) { | 941 DataForRecursion<LayerType>* data_for_children) { |
| 935 int parent_id = GetScrollParentId(data_from_ancestor, layer); | 942 int parent_id = GetScrollParentId(data_from_ancestor, layer); |
| 936 | 943 |
| 937 bool is_root = !layer->parent(); | 944 bool is_root = !Parent(layer); |
| 938 bool scrollable = layer->scrollable(); | 945 bool scrollable = layer->scrollable(); |
| 939 bool contains_non_fast_scrollable_region = | 946 bool contains_non_fast_scrollable_region = |
| 940 !layer->non_fast_scrollable_region().IsEmpty(); | 947 !layer->non_fast_scrollable_region().IsEmpty(); |
| 941 uint32_t main_thread_scrolling_reasons = | 948 uint32_t main_thread_scrolling_reasons = |
| 942 layer->main_thread_scrolling_reasons(); | 949 layer->main_thread_scrolling_reasons(); |
| 943 | 950 |
| 944 bool scroll_node_uninheritable_criteria = | 951 bool scroll_node_uninheritable_criteria = |
| 945 is_root || scrollable || contains_non_fast_scrollable_region; | 952 is_root || scrollable || contains_non_fast_scrollable_region; |
| 946 bool has_different_main_thread_scrolling_reasons = | 953 bool has_different_main_thread_scrolling_reasons = |
| 947 main_thread_scrolling_reasons != | 954 main_thread_scrolling_reasons != |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 layer->SetScrollTreeIndex(data_for_children->scroll_tree_parent); | 1016 layer->SetScrollTreeIndex(data_for_children->scroll_tree_parent); |
| 1010 } | 1017 } |
| 1011 | 1018 |
| 1012 template <typename LayerType> | 1019 template <typename LayerType> |
| 1013 void SetBackfaceVisibilityTransform(LayerType* layer, | 1020 void SetBackfaceVisibilityTransform(LayerType* layer, |
| 1014 bool created_transform_node) { | 1021 bool created_transform_node) { |
| 1015 const bool is_at_boundary_of_3d_rendering_context = | 1022 const bool is_at_boundary_of_3d_rendering_context = |
| 1016 IsAtBoundaryOf3dRenderingContext(layer); | 1023 IsAtBoundaryOf3dRenderingContext(layer); |
| 1017 if (layer->use_parent_backface_visibility()) { | 1024 if (layer->use_parent_backface_visibility()) { |
| 1018 DCHECK(!is_at_boundary_of_3d_rendering_context); | 1025 DCHECK(!is_at_boundary_of_3d_rendering_context); |
| 1019 DCHECK(layer->parent()); | 1026 DCHECK(Parent(layer)); |
| 1020 DCHECK(!layer->parent()->use_parent_backface_visibility()); | 1027 DCHECK(!Parent(layer)->use_parent_backface_visibility()); |
| 1021 layer->SetUseLocalTransformForBackfaceVisibility( | 1028 layer->SetUseLocalTransformForBackfaceVisibility( |
| 1022 layer->parent()->use_local_transform_for_backface_visibility()); | 1029 Parent(layer)->use_local_transform_for_backface_visibility()); |
| 1023 layer->SetShouldCheckBackfaceVisibility( | 1030 layer->SetShouldCheckBackfaceVisibility( |
| 1024 layer->parent()->should_check_backface_visibility()); | 1031 Parent(layer)->should_check_backface_visibility()); |
| 1025 } else { | 1032 } else { |
| 1026 // The current W3C spec on CSS transforms says that backface visibility | 1033 // The current W3C spec on CSS transforms says that backface visibility |
| 1027 // should be determined differently depending on whether the layer is in a | 1034 // should be determined differently depending on whether the layer is in a |
| 1028 // "3d rendering context" or not. For Chromium code, we can determine | 1035 // "3d rendering context" or not. For Chromium code, we can determine |
| 1029 // whether we are in a 3d rendering context by checking if the parent | 1036 // whether we are in a 3d rendering context by checking if the parent |
| 1030 // preserves 3d. | 1037 // preserves 3d. |
| 1031 const bool use_local_transform = | 1038 const bool use_local_transform = |
| 1032 !layer->Is3dSorted() || | 1039 !layer->Is3dSorted() || |
| 1033 (layer->Is3dSorted() && is_at_boundary_of_3d_rendering_context); | 1040 (layer->Is3dSorted() && is_at_boundary_of_3d_rendering_context); |
| 1034 layer->SetUseLocalTransformForBackfaceVisibility(use_local_transform); | 1041 layer->SetUseLocalTransformForBackfaceVisibility(use_local_transform); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 // The child should be included in its scroll parent's list of scroll | 1117 // The child should be included in its scroll parent's list of scroll |
| 1111 // children. | 1118 // children. |
| 1112 DCHECK(ScrollChildren(ScrollParent(current_child))->count(current_child)); | 1119 DCHECK(ScrollChildren(ScrollParent(current_child))->count(current_child)); |
| 1113 } | 1120 } |
| 1114 } | 1121 } |
| 1115 | 1122 |
| 1116 if (ScrollChildren(layer)) { | 1123 if (ScrollChildren(layer)) { |
| 1117 for (LayerType* scroll_child : *ScrollChildren(layer)) { | 1124 for (LayerType* scroll_child : *ScrollChildren(layer)) { |
| 1118 DCHECK_EQ(ScrollParent(scroll_child), layer); | 1125 DCHECK_EQ(ScrollParent(scroll_child), layer); |
| 1119 DataForRecursionFromChild<LayerType> data_from_child; | 1126 DataForRecursionFromChild<LayerType> data_from_child; |
| 1120 DCHECK(scroll_child->parent()); | 1127 DCHECK(Parent(scroll_child)); |
| 1121 data_for_children.effect_tree_parent = | 1128 data_for_children.effect_tree_parent = |
| 1122 scroll_child->parent()->effect_tree_index(); | 1129 Parent(scroll_child)->effect_tree_index(); |
| 1123 data_for_children.render_target = | 1130 data_for_children.render_target = |
| 1124 scroll_child->parent()->effect_tree_index(); | 1131 Parent(scroll_child)->effect_tree_index(); |
| 1125 BuildPropertyTreesInternal(scroll_child, data_for_children, | 1132 BuildPropertyTreesInternal(scroll_child, data_for_children, |
| 1126 &data_from_child); | 1133 &data_from_child); |
| 1127 data_to_parent->Merge(data_from_child); | 1134 data_to_parent->Merge(data_from_child); |
| 1128 } | 1135 } |
| 1129 } | 1136 } |
| 1130 | 1137 |
| 1131 if (layer->has_replica()) { | 1138 if (layer->has_replica()) { |
| 1132 DataForRecursionFromChild<LayerType> data_from_child; | 1139 DataForRecursionFromChild<LayerType> data_from_child; |
| 1133 BuildPropertyTreesInternal(layer->replica_layer(), data_for_children, | 1140 BuildPropertyTreesInternal(layer->replica_layer(), data_for_children, |
| 1134 &data_from_child); | 1141 &data_from_child); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 if (SkColorGetA(color) != 255) | 1353 if (SkColorGetA(color) != 255) |
| 1347 color = SkColorSetA(color, 255); | 1354 color = SkColorSetA(color, 255); |
| 1348 BuildPropertyTreesTopLevelInternal( | 1355 BuildPropertyTreesTopLevelInternal( |
| 1349 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1356 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1350 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1357 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1351 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1358 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1352 device_transform, property_trees, color); | 1359 device_transform, property_trees, color); |
| 1353 } | 1360 } |
| 1354 | 1361 |
| 1355 } // namespace cc | 1362 } // namespace cc |
| OLD | NEW |