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

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

Issue 1697613002: cc :: Move tracking of layer_property_changed to main thread (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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') | 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 <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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 flattens_inherited_transform(false), 138 flattens_inherited_transform(false),
139 node_and_ancestors_are_flat(true), 139 node_and_ancestors_are_flat(true),
140 node_and_ancestors_have_only_integer_translation(true), 140 node_and_ancestors_have_only_integer_translation(true),
141 scrolls(false), 141 scrolls(false),
142 needs_sublayer_scale(false), 142 needs_sublayer_scale(false),
143 affected_by_inner_viewport_bounds_delta_x(false), 143 affected_by_inner_viewport_bounds_delta_x(false),
144 affected_by_inner_viewport_bounds_delta_y(false), 144 affected_by_inner_viewport_bounds_delta_y(false),
145 affected_by_outer_viewport_bounds_delta_x(false), 145 affected_by_outer_viewport_bounds_delta_x(false),
146 affected_by_outer_viewport_bounds_delta_y(false), 146 affected_by_outer_viewport_bounds_delta_y(false),
147 in_subtree_of_page_scale_layer(false), 147 in_subtree_of_page_scale_layer(false),
148 transform_changed(false),
148 post_local_scale_factor(1.0f), 149 post_local_scale_factor(1.0f),
149 local_maximum_animation_target_scale(0.f), 150 local_maximum_animation_target_scale(0.f),
150 local_starting_animation_scale(0.f), 151 local_starting_animation_scale(0.f),
151 combined_maximum_animation_target_scale(0.f), 152 combined_maximum_animation_target_scale(0.f),
152 combined_starting_animation_scale(0.f) {} 153 combined_starting_animation_scale(0.f) {}
153 154
154 TransformNodeData::~TransformNodeData() { 155 TransformNodeData::~TransformNodeData() {
155 } 156 }
156 157
157 bool TransformNodeData::operator==(const TransformNodeData& other) const { 158 bool TransformNodeData::operator==(const TransformNodeData& other) const {
(...skipping 22 matching lines...) Expand all
180 affected_by_inner_viewport_bounds_delta_x == 181 affected_by_inner_viewport_bounds_delta_x ==
181 other.affected_by_inner_viewport_bounds_delta_x && 182 other.affected_by_inner_viewport_bounds_delta_x &&
182 affected_by_inner_viewport_bounds_delta_y == 183 affected_by_inner_viewport_bounds_delta_y ==
183 other.affected_by_inner_viewport_bounds_delta_y && 184 other.affected_by_inner_viewport_bounds_delta_y &&
184 affected_by_outer_viewport_bounds_delta_x == 185 affected_by_outer_viewport_bounds_delta_x ==
185 other.affected_by_outer_viewport_bounds_delta_x && 186 other.affected_by_outer_viewport_bounds_delta_x &&
186 affected_by_outer_viewport_bounds_delta_y == 187 affected_by_outer_viewport_bounds_delta_y ==
187 other.affected_by_outer_viewport_bounds_delta_y && 188 other.affected_by_outer_viewport_bounds_delta_y &&
188 in_subtree_of_page_scale_layer == 189 in_subtree_of_page_scale_layer ==
189 other.in_subtree_of_page_scale_layer && 190 other.in_subtree_of_page_scale_layer &&
191 transform_changed == other.transform_changed &&
190 post_local_scale_factor == other.post_local_scale_factor && 192 post_local_scale_factor == other.post_local_scale_factor &&
191 local_maximum_animation_target_scale == 193 local_maximum_animation_target_scale ==
192 other.local_maximum_animation_target_scale && 194 other.local_maximum_animation_target_scale &&
193 local_starting_animation_scale == 195 local_starting_animation_scale ==
194 other.local_starting_animation_scale && 196 other.local_starting_animation_scale &&
195 combined_maximum_animation_target_scale == 197 combined_maximum_animation_target_scale ==
196 other.combined_maximum_animation_target_scale && 198 other.combined_maximum_animation_target_scale &&
197 combined_starting_animation_scale == 199 combined_starting_animation_scale ==
198 other.combined_starting_animation_scale && 200 other.combined_starting_animation_scale &&
199 sublayer_scale == other.sublayer_scale && 201 sublayer_scale == other.sublayer_scale &&
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 data->set_affected_by_inner_viewport_bounds_delta_x( 265 data->set_affected_by_inner_viewport_bounds_delta_x(
264 affected_by_inner_viewport_bounds_delta_x); 266 affected_by_inner_viewport_bounds_delta_x);
265 data->set_affected_by_inner_viewport_bounds_delta_y( 267 data->set_affected_by_inner_viewport_bounds_delta_y(
266 affected_by_inner_viewport_bounds_delta_y); 268 affected_by_inner_viewport_bounds_delta_y);
267 data->set_affected_by_outer_viewport_bounds_delta_x( 269 data->set_affected_by_outer_viewport_bounds_delta_x(
268 affected_by_outer_viewport_bounds_delta_x); 270 affected_by_outer_viewport_bounds_delta_x);
269 data->set_affected_by_outer_viewport_bounds_delta_y( 271 data->set_affected_by_outer_viewport_bounds_delta_y(
270 affected_by_outer_viewport_bounds_delta_y); 272 affected_by_outer_viewport_bounds_delta_y);
271 273
272 data->set_in_subtree_of_page_scale_layer(in_subtree_of_page_scale_layer); 274 data->set_in_subtree_of_page_scale_layer(in_subtree_of_page_scale_layer);
275 data->set_transform_changed(transform_changed);
273 data->set_post_local_scale_factor(post_local_scale_factor); 276 data->set_post_local_scale_factor(post_local_scale_factor);
274 data->set_local_maximum_animation_target_scale( 277 data->set_local_maximum_animation_target_scale(
275 local_maximum_animation_target_scale); 278 local_maximum_animation_target_scale);
276 data->set_local_starting_animation_scale(local_starting_animation_scale); 279 data->set_local_starting_animation_scale(local_starting_animation_scale);
277 data->set_combined_maximum_animation_target_scale( 280 data->set_combined_maximum_animation_target_scale(
278 combined_maximum_animation_target_scale); 281 combined_maximum_animation_target_scale);
279 data->set_combined_starting_animation_scale( 282 data->set_combined_starting_animation_scale(
280 combined_starting_animation_scale); 283 combined_starting_animation_scale);
281 284
282 Vector2dFToProto(sublayer_scale, data->mutable_sublayer_scale()); 285 Vector2dFToProto(sublayer_scale, data->mutable_sublayer_scale());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 affected_by_inner_viewport_bounds_delta_x = 331 affected_by_inner_viewport_bounds_delta_x =
329 data.affected_by_inner_viewport_bounds_delta_x(); 332 data.affected_by_inner_viewport_bounds_delta_x();
330 affected_by_inner_viewport_bounds_delta_y = 333 affected_by_inner_viewport_bounds_delta_y =
331 data.affected_by_inner_viewport_bounds_delta_y(); 334 data.affected_by_inner_viewport_bounds_delta_y();
332 affected_by_outer_viewport_bounds_delta_x = 335 affected_by_outer_viewport_bounds_delta_x =
333 data.affected_by_outer_viewport_bounds_delta_x(); 336 data.affected_by_outer_viewport_bounds_delta_x();
334 affected_by_outer_viewport_bounds_delta_y = 337 affected_by_outer_viewport_bounds_delta_y =
335 data.affected_by_outer_viewport_bounds_delta_y(); 338 data.affected_by_outer_viewport_bounds_delta_y();
336 339
337 in_subtree_of_page_scale_layer = data.in_subtree_of_page_scale_layer(); 340 in_subtree_of_page_scale_layer = data.in_subtree_of_page_scale_layer();
341 transform_changed = data.transform_changed();
338 post_local_scale_factor = data.post_local_scale_factor(); 342 post_local_scale_factor = data.post_local_scale_factor();
339 local_maximum_animation_target_scale = 343 local_maximum_animation_target_scale =
340 data.local_maximum_animation_target_scale(); 344 data.local_maximum_animation_target_scale();
341 local_starting_animation_scale = data.local_starting_animation_scale(); 345 local_starting_animation_scale = data.local_starting_animation_scale();
342 combined_maximum_animation_target_scale = 346 combined_maximum_animation_target_scale =
343 data.combined_maximum_animation_target_scale(); 347 data.combined_maximum_animation_target_scale();
344 combined_starting_animation_scale = data.combined_starting_animation_scale(); 348 combined_starting_animation_scale = data.combined_starting_animation_scale();
345 349
346 sublayer_scale = ProtoToVector2dF(data.sublayer_scale()); 350 sublayer_scale = ProtoToVector2dF(data.sublayer_scale());
347 scroll_offset = ProtoToScrollOffset(data.scroll_offset()); 351 scroll_offset = ProtoToScrollOffset(data.scroll_offset());
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 gfx::Transform transform; 591 gfx::Transform transform;
588 return ComputeTransform(source_id, dest_id, &transform) && 592 return ComputeTransform(source_id, dest_id, &transform) &&
589 transform.Preserves2dAxisAlignment(); 593 transform.Preserves2dAxisAlignment();
590 } 594 }
591 595
592 bool TransformTree::NeedsSourceToParentUpdate(TransformNode* node) { 596 bool TransformTree::NeedsSourceToParentUpdate(TransformNode* node) {
593 return (source_to_parent_updates_allowed() && 597 return (source_to_parent_updates_allowed() &&
594 node->parent_id != node->data.source_node_id); 598 node->parent_id != node->data.source_node_id);
595 } 599 }
596 600
601 void TransformTree::ResetChangeTracking() {
602 for (int id = 1; id < static_cast<int>(size()); ++id) {
603 TransformNode* node = Node(id);
604 node->data.transform_changed = false;
605 }
606 }
607
597 void TransformTree::UpdateTransforms(int id) { 608 void TransformTree::UpdateTransforms(int id) {
598 TransformNode* node = Node(id); 609 TransformNode* node = Node(id);
599 TransformNode* parent_node = parent(node); 610 TransformNode* parent_node = parent(node);
600 TransformNode* target_node = Node(node->data.target_id); 611 TransformNode* target_node = Node(node->data.target_id);
612 TransformNode* source_node = Node(node->data.source_node_id);
601 if (node->data.needs_local_transform_update || 613 if (node->data.needs_local_transform_update ||
602 NeedsSourceToParentUpdate(node)) 614 NeedsSourceToParentUpdate(node))
603 UpdateLocalTransform(node); 615 UpdateLocalTransform(node);
604 else 616 else
605 UndoSnapping(node); 617 UndoSnapping(node);
606 UpdateScreenSpaceTransform(node, parent_node, target_node); 618 UpdateScreenSpaceTransform(node, parent_node, target_node);
607 UpdateSublayerScale(node); 619 UpdateSublayerScale(node);
608 UpdateTargetSpaceTransform(node, target_node); 620 UpdateTargetSpaceTransform(node, target_node);
609 UpdateAnimationProperties(node, parent_node); 621 UpdateAnimationProperties(node, parent_node);
610 UpdateSnapping(node); 622 UpdateSnapping(node);
611 UpdateNodeAndAncestorsHaveIntegerTranslations(node, parent_node); 623 UpdateNodeAndAncestorsHaveIntegerTranslations(node, parent_node);
624 UpdateTransformChanged(node, parent_node, source_node);
612 } 625 }
613 626
614 bool TransformTree::IsDescendant(int desc_id, int source_id) const { 627 bool TransformTree::IsDescendant(int desc_id, int source_id) const {
615 while (desc_id != source_id) { 628 while (desc_id != source_id) {
616 if (desc_id < 0) 629 if (desc_id < 0)
617 return false; 630 return false;
618 desc_id = Node(desc_id)->parent_id; 631 desc_id = Node(desc_id)->parent_id;
619 } 632 }
620 return true; 633 return true;
621 } 634 }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 node->data.to_parent.Translate(translation.x(), translation.y()); 974 node->data.to_parent.Translate(translation.x(), translation.y());
962 node->data.from_target.matrix().postTranslate(-translation.x(), 975 node->data.from_target.matrix().postTranslate(-translation.x(),
963 -translation.y(), 0); 976 -translation.y(), 0);
964 node->data.to_screen.Translate(translation.x(), translation.y()); 977 node->data.to_screen.Translate(translation.x(), translation.y());
965 node->data.from_screen.matrix().postTranslate(-translation.x(), 978 node->data.from_screen.matrix().postTranslate(-translation.x(),
966 -translation.y(), 0); 979 -translation.y(), 0);
967 980
968 node->data.scroll_snap = translation; 981 node->data.scroll_snap = translation;
969 } 982 }
970 983
984 void TransformTree::UpdateTransformChanged(TransformNode* node,
985 TransformNode* parent_node,
986 TransformNode* source_node) {
987 if (parent_node && parent_node->data.transform_changed) {
988 node->data.transform_changed = true;
989 return;
990 }
991
992 if (source_node && source_node->id != parent_node->id &&
993 source_to_parent_updates_allowed_ && source_node->data.transform_changed)
994 node->data.transform_changed = true;
995 }
996
971 void TransformTree::SetDeviceTransform(const gfx::Transform& transform, 997 void TransformTree::SetDeviceTransform(const gfx::Transform& transform,
972 gfx::PointF root_position) { 998 gfx::PointF root_position) {
973 gfx::Transform root_post_local = transform; 999 gfx::Transform root_post_local = transform;
974 TransformNode* node = Node(1); 1000 TransformNode* node = Node(1);
975 root_post_local.Scale(node->data.post_local_scale_factor, 1001 root_post_local.Scale(node->data.post_local_scale_factor,
976 node->data.post_local_scale_factor); 1002 node->data.post_local_scale_factor);
977 root_post_local.Translate(root_position.x(), root_position.y()); 1003 root_post_local.Translate(root_position.x(), root_position.y());
978 if (node->data.post_local == root_post_local) 1004 if (node->data.post_local == root_post_local)
979 return; 1005 return;
980 1006
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 outer_viewport_container_bounds_delta_ = bounds_delta; 1393 outer_viewport_container_bounds_delta_ = bounds_delta;
1368 transform_tree.UpdateOuterViewportContainerBoundsDelta(); 1394 transform_tree.UpdateOuterViewportContainerBoundsDelta();
1369 } 1395 }
1370 1396
1371 void PropertyTrees::SetInnerViewportScrollBoundsDelta( 1397 void PropertyTrees::SetInnerViewportScrollBoundsDelta(
1372 gfx::Vector2dF bounds_delta) { 1398 gfx::Vector2dF bounds_delta) {
1373 inner_viewport_scroll_bounds_delta_ = bounds_delta; 1399 inner_viewport_scroll_bounds_delta_ = bounds_delta;
1374 } 1400 }
1375 1401
1376 } // namespace cc 1402 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/property_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698