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

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

Issue 2929873002: Shifting layer position for sticky element to avoid passing unnessary variable to cc (Closed)
Patch Set: Created 3 years, 6 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
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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // from the destination to the source, with flattening, and then invert the 346 // from the destination to the source, with flattening, and then invert the
347 // result. 347 // result.
348 gfx::Transform dest_to_source; 348 gfx::Transform dest_to_source;
349 CombineTransformsBetween(dest_id, source_id, &dest_to_source); 349 CombineTransformsBetween(dest_id, source_id, &dest_to_source);
350 gfx::Transform source_to_dest; 350 gfx::Transform source_to_dest;
351 bool all_are_invertible = dest_to_source.GetInverse(&source_to_dest); 351 bool all_are_invertible = dest_to_source.GetInverse(&source_to_dest);
352 transform->PreconcatTransform(source_to_dest); 352 transform->PreconcatTransform(source_to_dest);
353 return all_are_invertible; 353 return all_are_invertible;
354 } 354 }
355 355
356 gfx::Vector2dF StickyPositionOffset(TransformTree* tree, TransformNode* node) { 356 gfx::Vector2dF StickyPositionOffset(TransformTree* tree, TransformNode* node) {
flackr 2017/06/08 18:56:18 I think now it definitely makes sense to add the c
yigu 2017/06/08 23:30:03 Done.
357 if (node->sticky_position_constraint_id == -1) 357 if (node->sticky_position_constraint_id == -1)
358 return gfx::Vector2dF(); 358 return gfx::Vector2dF();
359 StickyPositionNodeData* sticky_data = tree->StickyPositionData(node->id); 359 StickyPositionNodeData* sticky_data = tree->StickyPositionData(node->id);
360 const LayerStickyPositionConstraint& constraint = sticky_data->constraints; 360 const LayerStickyPositionConstraint& constraint = sticky_data->constraints;
361 auto& property_trees = *tree->property_trees(); 361 auto& property_trees = *tree->property_trees();
362 ScrollNode* scroll_node = 362 ScrollNode* scroll_node =
363 property_trees.scroll_tree.Node(sticky_data->scroll_ancestor); 363 property_trees.scroll_tree.Node(sticky_data->scroll_ancestor);
364 TransformNode* transform_node = 364 TransformNode* transform_node =
365 property_trees.transform_tree.Node(scroll_node->transform_id); 365 property_trees.transform_tree.Node(scroll_node->transform_id);
366 const auto& scroll_offset = transform_node->scroll_offset; 366 const auto& scroll_offset = transform_node->scroll_offset;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 top_delta = available_space; 454 top_delta = available_space;
455 sticky_offset.set_y(sticky_offset.y() + top_delta); 455 sticky_offset.set_y(sticky_offset.y() + top_delta);
456 } 456 }
457 457
458 sticky_data->total_sticky_box_sticky_offset = 458 sticky_data->total_sticky_box_sticky_offset =
459 ancestor_sticky_box_offset + sticky_offset; 459 ancestor_sticky_box_offset + sticky_offset;
460 sticky_data->total_containing_block_sticky_offset = 460 sticky_data->total_containing_block_sticky_offset =
461 ancestor_sticky_box_offset + ancestor_containing_block_offset + 461 ancestor_sticky_box_offset + ancestor_containing_block_offset +
462 sticky_offset; 462 sticky_offset;
463 463
464 return sticky_offset - node->offset_for_sticky_position_from_main_thread; 464 return sticky_offset;
465 } 465 }
466 466
467 void TransformTree::UpdateLocalTransform(TransformNode* node) { 467 void TransformTree::UpdateLocalTransform(TransformNode* node) {
468 gfx::Transform transform = node->post_local; 468 gfx::Transform transform = node->post_local;
469 if (NeedsSourceToParentUpdate(node)) { 469 if (NeedsSourceToParentUpdate(node)) {
470 gfx::Transform to_parent; 470 gfx::Transform to_parent;
471 ComputeTranslation(node->source_node_id, node->parent_id, &to_parent); 471 ComputeTranslation(node->source_node_id, node->parent_id, &to_parent);
472 gfx::Vector2dF unsnapping; 472 gfx::Vector2dF unsnapping;
473 TransformNode* current; 473 TransformNode* current;
474 TransformNode* parent_node; 474 TransformNode* parent_node;
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 const EffectNode* effect_node = effect_tree.Node(effect_id); 2193 const EffectNode* effect_node = effect_tree.Node(effect_id);
2194 2194
2195 if (effect_node->surface_contents_scale.x() != 0.0 && 2195 if (effect_node->surface_contents_scale.x() != 0.0 &&
2196 effect_node->surface_contents_scale.y() != 0.0) 2196 effect_node->surface_contents_scale.y() != 0.0)
2197 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), 2197 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(),
2198 1.0 / effect_node->surface_contents_scale.y()); 2198 1.0 / effect_node->surface_contents_scale.y());
2199 return screen_space_transform; 2199 return screen_space_transform;
2200 } 2200 }
2201 2201
2202 } // namespace cc 2202 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698