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

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

Issue 1864183002: cc: Main thread skip single layers instead of subtrees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Format the comments Created 4 years, 8 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/property_tree.h ('k') | cc/trees/property_tree_unittest.cc » ('j') | 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 TransformNodeData::TransformNodeData() 133 TransformNodeData::TransformNodeData()
134 : target_id(-1), 134 : target_id(-1),
135 content_target_id(-1), 135 content_target_id(-1),
136 source_node_id(-1), 136 source_node_id(-1),
137 sorting_context_id(0), 137 sorting_context_id(0),
138 needs_local_transform_update(true), 138 needs_local_transform_update(true),
139 is_invertible(true), 139 is_invertible(true),
140 ancestors_are_invertible(true), 140 ancestors_are_invertible(true),
141 is_animated(false), 141 is_animated(false),
142 to_screen_is_animated(false), 142 to_screen_is_potentially_animated(false),
143 has_only_translation_animations(true), 143 has_only_translation_animations(true),
144 to_screen_has_scale_animation(false), 144 to_screen_has_scale_animation(false),
145 flattens_inherited_transform(false), 145 flattens_inherited_transform(false),
146 node_and_ancestors_are_flat(true), 146 node_and_ancestors_are_flat(true),
147 node_and_ancestors_have_only_integer_translation(true), 147 node_and_ancestors_have_only_integer_translation(true),
148 scrolls(false), 148 scrolls(false),
149 needs_sublayer_scale(false), 149 needs_sublayer_scale(false),
150 affected_by_inner_viewport_bounds_delta_x(false), 150 affected_by_inner_viewport_bounds_delta_x(false),
151 affected_by_inner_viewport_bounds_delta_y(false), 151 affected_by_inner_viewport_bounds_delta_y(false),
152 affected_by_outer_viewport_bounds_delta_x(false), 152 affected_by_outer_viewport_bounds_delta_x(false),
(...skipping 17 matching lines...) Expand all
170 to_target == other.to_target && from_target == other.from_target && 170 to_target == other.to_target && from_target == other.from_target &&
171 to_screen == other.to_screen && from_screen == other.from_screen && 171 to_screen == other.to_screen && from_screen == other.from_screen &&
172 target_id == other.target_id && 172 target_id == other.target_id &&
173 content_target_id == other.content_target_id && 173 content_target_id == other.content_target_id &&
174 source_node_id == other.source_node_id && 174 source_node_id == other.source_node_id &&
175 sorting_context_id == other.sorting_context_id && 175 sorting_context_id == other.sorting_context_id &&
176 needs_local_transform_update == other.needs_local_transform_update && 176 needs_local_transform_update == other.needs_local_transform_update &&
177 is_invertible == other.is_invertible && 177 is_invertible == other.is_invertible &&
178 ancestors_are_invertible == other.ancestors_are_invertible && 178 ancestors_are_invertible == other.ancestors_are_invertible &&
179 is_animated == other.is_animated && 179 is_animated == other.is_animated &&
180 to_screen_is_animated == other.to_screen_is_animated && 180 to_screen_is_potentially_animated ==
181 other.to_screen_is_potentially_animated &&
181 has_only_translation_animations == 182 has_only_translation_animations ==
182 other.has_only_translation_animations && 183 other.has_only_translation_animations &&
183 to_screen_has_scale_animation == other.to_screen_has_scale_animation && 184 to_screen_has_scale_animation == other.to_screen_has_scale_animation &&
184 flattens_inherited_transform == other.flattens_inherited_transform && 185 flattens_inherited_transform == other.flattens_inherited_transform &&
185 node_and_ancestors_are_flat == other.node_and_ancestors_are_flat && 186 node_and_ancestors_are_flat == other.node_and_ancestors_are_flat &&
186 node_and_ancestors_have_only_integer_translation == 187 node_and_ancestors_have_only_integer_translation ==
187 other.node_and_ancestors_have_only_integer_translation && 188 other.node_and_ancestors_have_only_integer_translation &&
188 scrolls == other.scrolls && 189 scrolls == other.scrolls &&
189 needs_sublayer_scale == other.needs_sublayer_scale && 190 needs_sublayer_scale == other.needs_sublayer_scale &&
190 affected_by_inner_viewport_bounds_delta_x == 191 affected_by_inner_viewport_bounds_delta_x ==
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 data->set_content_target_id(content_target_id); 253 data->set_content_target_id(content_target_id);
253 data->set_source_node_id(source_node_id); 254 data->set_source_node_id(source_node_id);
254 data->set_sorting_context_id(sorting_context_id); 255 data->set_sorting_context_id(sorting_context_id);
255 256
256 data->set_needs_local_transform_update(needs_local_transform_update); 257 data->set_needs_local_transform_update(needs_local_transform_update);
257 258
258 data->set_is_invertible(is_invertible); 259 data->set_is_invertible(is_invertible);
259 data->set_ancestors_are_invertible(ancestors_are_invertible); 260 data->set_ancestors_are_invertible(ancestors_are_invertible);
260 261
261 data->set_is_animated(is_animated); 262 data->set_is_animated(is_animated);
262 data->set_to_screen_is_animated(to_screen_is_animated); 263 data->set_to_screen_is_potentially_animated(
264 to_screen_is_potentially_animated);
263 data->set_has_only_translation_animations(has_only_translation_animations); 265 data->set_has_only_translation_animations(has_only_translation_animations);
264 data->set_to_screen_has_scale_animation(to_screen_has_scale_animation); 266 data->set_to_screen_has_scale_animation(to_screen_has_scale_animation);
265 267
266 data->set_flattens_inherited_transform(flattens_inherited_transform); 268 data->set_flattens_inherited_transform(flattens_inherited_transform);
267 data->set_node_and_ancestors_are_flat(node_and_ancestors_are_flat); 269 data->set_node_and_ancestors_are_flat(node_and_ancestors_are_flat);
268 270
269 data->set_node_and_ancestors_have_only_integer_translation( 271 data->set_node_and_ancestors_have_only_integer_translation(
270 node_and_ancestors_have_only_integer_translation); 272 node_and_ancestors_have_only_integer_translation);
271 data->set_scrolls(scrolls); 273 data->set_scrolls(scrolls);
272 data->set_needs_sublayer_scale(needs_sublayer_scale); 274 data->set_needs_sublayer_scale(needs_sublayer_scale);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 content_target_id = data.content_target_id(); 320 content_target_id = data.content_target_id();
319 source_node_id = data.source_node_id(); 321 source_node_id = data.source_node_id();
320 sorting_context_id = data.sorting_context_id(); 322 sorting_context_id = data.sorting_context_id();
321 323
322 needs_local_transform_update = data.needs_local_transform_update(); 324 needs_local_transform_update = data.needs_local_transform_update();
323 325
324 is_invertible = data.is_invertible(); 326 is_invertible = data.is_invertible();
325 ancestors_are_invertible = data.ancestors_are_invertible(); 327 ancestors_are_invertible = data.ancestors_are_invertible();
326 328
327 is_animated = data.is_animated(); 329 is_animated = data.is_animated();
328 to_screen_is_animated = data.to_screen_is_animated(); 330 to_screen_is_potentially_animated = data.to_screen_is_potentially_animated();
329 has_only_translation_animations = data.has_only_translation_animations(); 331 has_only_translation_animations = data.has_only_translation_animations();
330 to_screen_has_scale_animation = data.to_screen_has_scale_animation(); 332 to_screen_has_scale_animation = data.to_screen_has_scale_animation();
331 333
332 flattens_inherited_transform = data.flattens_inherited_transform(); 334 flattens_inherited_transform = data.flattens_inherited_transform();
333 node_and_ancestors_are_flat = data.node_and_ancestors_are_flat(); 335 node_and_ancestors_are_flat = data.node_and_ancestors_are_flat();
334 336
335 node_and_ancestors_have_only_integer_translation = 337 node_and_ancestors_have_only_integer_translation =
336 data.node_and_ancestors_have_only_integer_translation(); 338 data.node_and_ancestors_have_only_integer_translation();
337 scrolls = data.scrolls(); 339 scrolls = data.scrolls();
338 needs_sublayer_scale = data.needs_sublayer_scale(); 340 needs_sublayer_scale = data.needs_sublayer_scale();
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 node->data.set_to_parent(transform); 858 node->data.set_to_parent(transform);
857 node->data.needs_local_transform_update = false; 859 node->data.needs_local_transform_update = false;
858 } 860 }
859 861
860 void TransformTree::UpdateScreenSpaceTransform(TransformNode* node, 862 void TransformTree::UpdateScreenSpaceTransform(TransformNode* node,
861 TransformNode* parent_node, 863 TransformNode* parent_node,
862 TransformNode* target_node) { 864 TransformNode* target_node) {
863 if (!parent_node) { 865 if (!parent_node) {
864 node->data.to_screen = node->data.to_parent; 866 node->data.to_screen = node->data.to_parent;
865 node->data.ancestors_are_invertible = true; 867 node->data.ancestors_are_invertible = true;
866 node->data.to_screen_is_animated = false; 868 node->data.to_screen_is_potentially_animated = false;
867 node->data.node_and_ancestors_are_flat = node->data.to_parent.IsFlat(); 869 node->data.node_and_ancestors_are_flat = node->data.to_parent.IsFlat();
868 } else { 870 } else {
869 node->data.to_screen = parent_node->data.to_screen; 871 node->data.to_screen = parent_node->data.to_screen;
870 if (node->data.flattens_inherited_transform) 872 if (node->data.flattens_inherited_transform)
871 node->data.to_screen.FlattenTo2d(); 873 node->data.to_screen.FlattenTo2d();
872 node->data.to_screen.PreconcatTransform(node->data.to_parent); 874 node->data.to_screen.PreconcatTransform(node->data.to_parent);
873 node->data.ancestors_are_invertible = 875 node->data.ancestors_are_invertible =
874 parent_node->data.ancestors_are_invertible; 876 parent_node->data.ancestors_are_invertible;
875 node->data.node_and_ancestors_are_flat = 877 node->data.node_and_ancestors_are_flat =
876 parent_node->data.node_and_ancestors_are_flat && 878 parent_node->data.node_and_ancestors_are_flat &&
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 node->data.ancestors_are_invertible = false; 916 node->data.ancestors_are_invertible = false;
915 } 917 }
916 918
917 void TransformTree::UpdateAnimationProperties(TransformNode* node, 919 void TransformTree::UpdateAnimationProperties(TransformNode* node,
918 TransformNode* parent_node) { 920 TransformNode* parent_node) {
919 bool ancestor_is_animating = false; 921 bool ancestor_is_animating = false;
920 bool ancestor_is_animating_scale = false; 922 bool ancestor_is_animating_scale = false;
921 float ancestor_maximum_target_scale = 0.f; 923 float ancestor_maximum_target_scale = 0.f;
922 float ancestor_starting_animation_scale = 0.f; 924 float ancestor_starting_animation_scale = 0.f;
923 if (parent_node) { 925 if (parent_node) {
924 ancestor_is_animating = parent_node->data.to_screen_is_animated; 926 ancestor_is_animating = parent_node->data.to_screen_is_potentially_animated;
925 ancestor_is_animating_scale = 927 ancestor_is_animating_scale =
926 parent_node->data.to_screen_has_scale_animation; 928 parent_node->data.to_screen_has_scale_animation;
927 ancestor_maximum_target_scale = 929 ancestor_maximum_target_scale =
928 parent_node->data.combined_maximum_animation_target_scale; 930 parent_node->data.combined_maximum_animation_target_scale;
929 ancestor_starting_animation_scale = 931 ancestor_starting_animation_scale =
930 parent_node->data.combined_starting_animation_scale; 932 parent_node->data.combined_starting_animation_scale;
931 } 933 }
932 node->data.to_screen_is_animated = 934 node->data.to_screen_is_potentially_animated =
933 node->data.is_animated || ancestor_is_animating; 935 node->data.is_animated || ancestor_is_animating;
934 node->data.to_screen_has_scale_animation = 936 node->data.to_screen_has_scale_animation =
935 !node->data.has_only_translation_animations || 937 !node->data.has_only_translation_animations ||
936 ancestor_is_animating_scale; 938 ancestor_is_animating_scale;
937 939
938 // Once we've failed to compute a maximum animated scale at an ancestor, we 940 // Once we've failed to compute a maximum animated scale at an ancestor, we
939 // continue to fail. 941 // continue to fail.
940 bool failed_at_ancestor = 942 bool failed_at_ancestor =
941 ancestor_is_animating_scale && ancestor_maximum_target_scale == 0.f; 943 ancestor_is_animating_scale && ancestor_maximum_target_scale == 0.f;
942 944
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 1007
1006 void TransformTree::UndoSnapping(TransformNode* node) { 1008 void TransformTree::UndoSnapping(TransformNode* node) {
1007 // to_parent transform has the scroll snap from previous frame baked in. 1009 // to_parent transform has the scroll snap from previous frame baked in.
1008 // We need to undo it and use the un-snapped transform to compute current 1010 // We need to undo it and use the un-snapped transform to compute current
1009 // target and screen space transforms. 1011 // target and screen space transforms.
1010 node->data.to_parent.Translate(-node->data.scroll_snap.x(), 1012 node->data.to_parent.Translate(-node->data.scroll_snap.x(),
1011 -node->data.scroll_snap.y()); 1013 -node->data.scroll_snap.y());
1012 } 1014 }
1013 1015
1014 void TransformTree::UpdateSnapping(TransformNode* node) { 1016 void TransformTree::UpdateSnapping(TransformNode* node) {
1015 if (!node->data.scrolls || node->data.to_screen_is_animated || 1017 if (!node->data.scrolls || node->data.to_screen_is_potentially_animated ||
1016 !node->data.to_target.IsScaleOrTranslation() || 1018 !node->data.to_target.IsScaleOrTranslation() ||
1017 !node->data.ancestors_are_invertible) { 1019 !node->data.ancestors_are_invertible) {
1018 return; 1020 return;
1019 } 1021 }
1020 1022
1021 // Scroll snapping must be done in target space (the pixels we care about). 1023 // Scroll snapping must be done in target space (the pixels we care about).
1022 // This means we effectively snap the target space transform. If TT is the 1024 // This means we effectively snap the target space transform. If TT is the
1023 // target space transform and TT' is TT with its translation components 1025 // target space transform and TT' is TT with its translation components
1024 // rounded, then what we're after is the scroll delta X, where TT * X = TT'. 1026 // rounded, then what we're after is the scroll delta X, where TT * X = TT'.
1025 // I.e., we want a transform that will realize our scroll snap. It follows 1027 // I.e., we want a transform that will realize our scroll snap. It follows
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 break; 1920 break;
1919 case ALL_TREES: 1921 case ALL_TREES:
1920 transform_tree.ResetChangeTracking(); 1922 transform_tree.ResetChangeTracking();
1921 effect_tree.ResetChangeTracking(); 1923 effect_tree.ResetChangeTracking();
1922 } 1924 }
1923 changed = false; 1925 changed = false;
1924 full_tree_damaged = false; 1926 full_tree_damaged = false;
1925 } 1927 }
1926 1928
1927 } // namespace cc 1929 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/property_tree.h ('k') | cc/trees/property_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698