Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: cc/trees/property_tree_builder.cc

Issue 2885953002: cc : Fix axis alignment tracking bug in property tree building (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 float page_scale_factor; 48 float page_scale_factor;
49 bool in_subtree_of_page_scale_layer; 49 bool in_subtree_of_page_scale_layer;
50 bool affected_by_inner_viewport_bounds_delta; 50 bool affected_by_inner_viewport_bounds_delta;
51 bool affected_by_outer_viewport_bounds_delta; 51 bool affected_by_outer_viewport_bounds_delta;
52 bool should_flatten; 52 bool should_flatten;
53 bool is_hidden; 53 bool is_hidden;
54 uint32_t main_thread_scrolling_reasons; 54 uint32_t main_thread_scrolling_reasons;
55 bool scroll_tree_parent_created_by_uninheritable_criteria; 55 bool scroll_tree_parent_created_by_uninheritable_criteria;
56 const gfx::Transform* device_transform; 56 const gfx::Transform* device_transform;
57 gfx::Transform compound_transform_since_render_target; 57 gfx::Transform compound_transform_since_render_target;
58 bool axis_align_since_render_target; 58 bool animation_axis_aligned_since_render_target;
59 SkColor safe_opaque_background_color; 59 SkColor safe_opaque_background_color;
60 }; 60 };
61 61
62 static LayerPositionConstraint PositionConstraint(Layer* layer) { 62 static LayerPositionConstraint PositionConstraint(Layer* layer) {
63 return layer->position_constraint(); 63 return layer->position_constraint();
64 } 64 }
65 65
66 static LayerPositionConstraint PositionConstraint(LayerImpl* layer) { 66 static LayerPositionConstraint PositionConstraint(LayerImpl* layer) {
67 return layer->test_properties()->position_constraint; 67 return layer->test_properties()->position_constraint;
68 } 68 }
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 return layer->subtree_property_changed(); 720 return layer->subtree_property_changed();
721 } 721 }
722 722
723 static inline bool PropertyChanged(LayerImpl* layer) { 723 static inline bool PropertyChanged(LayerImpl* layer) {
724 return false; 724 return false;
725 } 725 }
726 726
727 template <typename LayerType> 727 template <typename LayerType>
728 bool ShouldCreateRenderSurface(LayerType* layer, 728 bool ShouldCreateRenderSurface(LayerType* layer,
729 gfx::Transform current_transform, 729 gfx::Transform current_transform,
730 bool axis_aligned) { 730 bool animation_axis_aligned) {
731 const bool preserves_2d_axis_alignment = 731 const bool preserves_2d_axis_alignment =
732 (current_transform * Transform(layer)).Preserves2dAxisAlignment() && 732 current_transform.Preserves2dAxisAlignment() && animation_axis_aligned;
733 axis_aligned && AnimationsPreserveAxisAlignment(layer);
734 const bool is_root = !Parent(layer); 733 const bool is_root = !Parent(layer);
735 if (is_root) 734 if (is_root)
736 return true; 735 return true;
737 736
738 // If the layer uses a mask. 737 // If the layer uses a mask.
739 if (MaskLayer(layer)) { 738 if (MaskLayer(layer)) {
740 return true; 739 return true;
741 } 740 }
742 741
743 // If the layer uses a CSS filter. 742 // If the layer uses a CSS filter.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 LayerType* layer, 877 LayerType* layer,
879 DataForRecursion<LayerType>* data_for_children) { 878 DataForRecursion<LayerType>* data_for_children) {
880 const bool is_root = !Parent(layer); 879 const bool is_root = !Parent(layer);
881 const bool has_transparency = EffectiveOpacity(layer) != 1.f; 880 const bool has_transparency = EffectiveOpacity(layer) != 1.f;
882 const bool has_potential_opacity_animation = 881 const bool has_potential_opacity_animation =
883 HasPotentialOpacityAnimation(layer); 882 HasPotentialOpacityAnimation(layer);
884 const bool has_potential_filter_animation = 883 const bool has_potential_filter_animation =
885 HasPotentiallyRunningFilterAnimation(layer); 884 HasPotentiallyRunningFilterAnimation(layer);
886 const bool has_proxied_opacity = 885 const bool has_proxied_opacity =
887 !!(layer->mutable_properties() & MutableProperty::kOpacity); 886 !!(layer->mutable_properties() & MutableProperty::kOpacity);
887
888 data_for_children->animation_axis_aligned_since_render_target &=
889 AnimationsPreserveAxisAlignment(layer);
890 data_for_children->compound_transform_since_render_target *= Transform(layer);
888 const bool should_create_render_surface = ShouldCreateRenderSurface( 891 const bool should_create_render_surface = ShouldCreateRenderSurface(
889 layer, data_from_ancestor.compound_transform_since_render_target, 892 layer, data_for_children->compound_transform_since_render_target,
890 data_from_ancestor.axis_align_since_render_target); 893 data_for_children->animation_axis_aligned_since_render_target);
891 data_for_children->axis_align_since_render_target &=
892 AnimationsPreserveAxisAlignment(layer);
893 894
894 bool requires_node = is_root || has_transparency || 895 bool requires_node = is_root || has_transparency ||
895 has_potential_opacity_animation || has_proxied_opacity || 896 has_potential_opacity_animation || has_proxied_opacity ||
896 should_create_render_surface; 897 should_create_render_surface;
897 898
898 int parent_id = data_from_ancestor.effect_tree_parent; 899 int parent_id = data_from_ancestor.effect_tree_parent;
899 900
900 if (!requires_node) { 901 if (!requires_node) {
901 layer->SetEffectTreeIndex(parent_id); 902 layer->SetEffectTreeIndex(parent_id);
902 data_for_children->effect_tree_parent = parent_id; 903 data_for_children->effect_tree_parent = parent_id;
903 data_for_children->compound_transform_since_render_target *=
904 Transform(layer);
905 return false; 904 return false;
906 } 905 }
907 906
908 EffectTree& effect_tree = data_for_children->property_trees->effect_tree; 907 EffectTree& effect_tree = data_for_children->property_trees->effect_tree;
909 int node_id = effect_tree.Insert(EffectNode(), parent_id); 908 int node_id = effect_tree.Insert(EffectNode(), parent_id);
910 EffectNode* node = effect_tree.back(); 909 EffectNode* node = effect_tree.back();
911 910
912 node->owning_layer_id = layer->id(); 911 node->owning_layer_id = layer->id();
913 node->opacity = Opacity(layer); 912 node->opacity = Opacity(layer);
914 node->blend_mode = BlendMode(layer); 913 node->blend_mode = BlendMode(layer);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 std::vector<std::unique_ptr<CopyOutputRequest>> layer_copy_requests; 973 std::vector<std::unique_ptr<CopyOutputRequest>> layer_copy_requests;
975 TakeCopyRequests(layer, &layer_copy_requests); 974 TakeCopyRequests(layer, &layer_copy_requests);
976 for (auto& it : layer_copy_requests) { 975 for (auto& it : layer_copy_requests) {
977 effect_tree.AddCopyRequest(node_id, std::move(it)); 976 effect_tree.AddCopyRequest(node_id, std::move(it));
978 } 977 }
979 layer_copy_requests.clear(); 978 layer_copy_requests.clear();
980 979
981 if (should_create_render_surface) { 980 if (should_create_render_surface) {
982 data_for_children->compound_transform_since_render_target = 981 data_for_children->compound_transform_since_render_target =
983 gfx::Transform(); 982 gfx::Transform();
984 data_for_children->axis_align_since_render_target = true; 983 data_for_children->animation_axis_aligned_since_render_target = true;
985 } 984 }
986 return should_create_render_surface; 985 return should_create_render_surface;
987 } 986 }
988 987
989 template <typename LayerType> 988 template <typename LayerType>
990 void AddScrollNodeIfNeeded( 989 void AddScrollNodeIfNeeded(
991 const DataForRecursion<LayerType>& data_from_ancestor, 990 const DataForRecursion<LayerType>& data_from_ancestor,
992 LayerType* layer, 991 LayerType* layer,
993 DataForRecursion<LayerType>* data_for_children) { 992 DataForRecursion<LayerType>* data_for_children) {
994 int parent_id = GetScrollParentId(data_from_ancestor, layer); 993 int parent_id = GetScrollParentId(data_from_ancestor, layer);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 data_for_recursion.should_flatten = false; 1264 data_for_recursion.should_flatten = false;
1266 data_for_recursion.is_hidden = false; 1265 data_for_recursion.is_hidden = false;
1267 data_for_recursion.main_thread_scrolling_reasons = 1266 data_for_recursion.main_thread_scrolling_reasons =
1268 MainThreadScrollingReason::kNotScrollingOnMain; 1267 MainThreadScrollingReason::kNotScrollingOnMain;
1269 data_for_recursion.scroll_tree_parent_created_by_uninheritable_criteria = 1268 data_for_recursion.scroll_tree_parent_created_by_uninheritable_criteria =
1270 true; 1269 true;
1271 data_for_recursion.device_transform = &device_transform; 1270 data_for_recursion.device_transform = &device_transform;
1272 1271
1273 data_for_recursion.property_trees->clear(); 1272 data_for_recursion.property_trees->clear();
1274 data_for_recursion.compound_transform_since_render_target = gfx::Transform(); 1273 data_for_recursion.compound_transform_since_render_target = gfx::Transform();
1275 data_for_recursion.axis_align_since_render_target = true; 1274 data_for_recursion.animation_axis_aligned_since_render_target = true;
1276 data_for_recursion.property_trees->transform_tree.set_device_scale_factor( 1275 data_for_recursion.property_trees->transform_tree.set_device_scale_factor(
1277 device_scale_factor); 1276 device_scale_factor);
1278 data_for_recursion.safe_opaque_background_color = color; 1277 data_for_recursion.safe_opaque_background_color = color;
1279 1278
1280 ClipNode root_clip; 1279 ClipNode root_clip;
1281 root_clip.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP; 1280 root_clip.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP;
1282 root_clip.clip = gfx::RectF(viewport); 1281 root_clip.clip = gfx::RectF(viewport);
1283 root_clip.transform_id = TransformTree::kRootNodeId; 1282 root_clip.transform_id = TransformTree::kRootNodeId;
1284 data_for_recursion.clip_tree_parent = 1283 data_for_recursion.clip_tree_parent =
1285 data_for_recursion.property_trees->clip_tree.Insert( 1284 data_for_recursion.property_trees->clip_tree.Insert(
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 root_layer, page_scale_layer, inner_viewport_scroll_layer, 1378 root_layer, page_scale_layer, inner_viewport_scroll_layer,
1380 outer_viewport_scroll_layer, overscroll_elasticity_layer, 1379 outer_viewport_scroll_layer, overscroll_elasticity_layer,
1381 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 1380 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
1382 device_transform, property_trees, color); 1381 device_transform, property_trees, color);
1383 property_trees->effect_tree.CreateOrReuseRenderSurfaces( 1382 property_trees->effect_tree.CreateOrReuseRenderSurfaces(
1384 &render_surfaces, root_layer->layer_tree_impl()); 1383 &render_surfaces, root_layer->layer_tree_impl());
1385 property_trees->ResetCachedData(); 1384 property_trees->ResetCachedData();
1386 } 1385 }
1387 1386
1388 } // namespace cc 1387 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698