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

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

Issue 2929873002: Shifting layer position for sticky element to avoid passing unnessary variable to cc (Closed)
Patch Set: Bug fix 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
« no previous file with comments | « cc/trees/property_tree.cc ('k') | cc/trees/transform_node.h » ('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 "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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 static LayerStickyPositionConstraint StickyPositionConstraint(Layer* layer) { 70 static LayerStickyPositionConstraint StickyPositionConstraint(Layer* layer) {
71 return layer->sticky_position_constraint(); 71 return layer->sticky_position_constraint();
72 } 72 }
73 73
74 static LayerStickyPositionConstraint StickyPositionConstraint( 74 static LayerStickyPositionConstraint StickyPositionConstraint(
75 LayerImpl* layer) { 75 LayerImpl* layer) {
76 return layer->test_properties()->sticky_position_constraint; 76 return layer->test_properties()->sticky_position_constraint;
77 } 77 }
78 78
79 static gfx::Size OffsetForStickyPositionFromMainThread(Layer* layer) {
80 return layer->offset_for_sticky_position_from_main_thread();
81 }
82
83 static gfx::Size OffsetForStickyPositionFromMainThread(LayerImpl* layer) {
84 return layer->test_properties()->offset_for_sticky_position_from_main_thread;
85 }
86
87 static LayerImplList& Children(LayerImpl* layer) { 79 static LayerImplList& Children(LayerImpl* layer) {
88 return layer->test_properties()->children; 80 return layer->test_properties()->children;
89 } 81 }
90 82
91 static const LayerList& Children(Layer* layer) { 83 static const LayerList& Children(Layer* layer) {
92 return layer->children(); 84 return layer->children();
93 } 85 }
94 86
95 static LayerImpl* ChildAt(LayerImpl* layer, int index) { 87 static LayerImpl* ChildAt(LayerImpl* layer, int index) {
96 return layer->test_properties()->children[index]; 88 return layer->test_properties()->children[index];
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 int shifting_containing_block_layer_id = 555 int shifting_containing_block_layer_id =
564 sticky_data->constraints.nearest_layer_shifting_containing_block; 556 sticky_data->constraints.nearest_layer_shifting_containing_block;
565 if (shifting_containing_block_layer_id != Layer::INVALID_ID) { 557 if (shifting_containing_block_layer_id != Layer::INVALID_ID) {
566 sticky_data->nearest_node_shifting_containing_block = 558 sticky_data->nearest_node_shifting_containing_block =
567 data_for_children->property_trees->transform_tree 559 data_for_children->property_trees->transform_tree
568 .FindNodeIndexFromOwningLayerId( 560 .FindNodeIndexFromOwningLayerId(
569 shifting_containing_block_layer_id); 561 shifting_containing_block_layer_id);
570 DCHECK(sticky_data->nearest_node_shifting_containing_block != 562 DCHECK(sticky_data->nearest_node_shifting_containing_block !=
571 TransformTree::kInvalidNodeId); 563 TransformTree::kInvalidNodeId);
572 } 564 }
573 node->offset_for_sticky_position_from_main_thread =
574 gfx::Vector2dF(OffsetForStickyPositionFromMainThread(layer).width(),
575 OffsetForStickyPositionFromMainThread(layer).height());
576 } 565 }
577 566
578 node->needs_local_transform_update = true; 567 node->needs_local_transform_update = true;
579 data_from_ancestor.property_trees->transform_tree.UpdateTransforms(node->id); 568 data_from_ancestor.property_trees->transform_tree.UpdateTransforms(node->id);
580 569
581 layer->set_offset_to_transform_parent(gfx::Vector2dF()); 570 layer->set_offset_to_transform_parent(gfx::Vector2dF());
582 571
583 // Flattening (if needed) will be handled by |node|. 572 // Flattening (if needed) will be handled by |node|.
584 layer->set_should_flatten_transform_from_property_tree(false); 573 layer->set_should_flatten_transform_from_property_tree(false);
585 574
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 root_layer, page_scale_layer, inner_viewport_scroll_layer, 1394 root_layer, page_scale_layer, inner_viewport_scroll_layer,
1406 outer_viewport_scroll_layer, overscroll_elasticity_layer, 1395 outer_viewport_scroll_layer, overscroll_elasticity_layer,
1407 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 1396 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
1408 device_transform, property_trees, color); 1397 device_transform, property_trees, color);
1409 property_trees->effect_tree.CreateOrReuseRenderSurfaces( 1398 property_trees->effect_tree.CreateOrReuseRenderSurfaces(
1410 &render_surfaces, root_layer->layer_tree_impl()); 1399 &render_surfaces, root_layer->layer_tree_impl());
1411 property_trees->ResetCachedData(); 1400 property_trees->ResetCachedData();
1412 } 1401 }
1413 1402
1414 } // namespace cc 1403 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/property_tree.cc ('k') | cc/trees/transform_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698