Index: cc/trees/property_tree_builder.cc |
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc |
index ef843d5d9890e67baba1396156fbca65bf06cb85..2c5a3b7d80b9dccd7e472e58abafab846a61d425 100644 |
--- a/cc/trees/property_tree_builder.cc |
+++ b/cc/trees/property_tree_builder.cc |
@@ -759,10 +759,36 @@ bool AddTransformNodeIfNeeded( |
.AddNodeAffectedByOuterViewportBoundsDelta(node->id); |
} |
} |
+ // TODO(smcgruer): Pass main thread sticky-shifting offsets of |
+ // non-promoted ancestors, or promote all ancestor sticky elements. |
+ // See http://crbug.com/702229 |
sticky_data->main_thread_offset = |
layer->position().OffsetFromOrigin() - |
sticky_data->constraints.parent_relative_sticky_box_offset |
.OffsetFromOrigin(); |
+ |
+ // Copy the ancestor nodes for later use. These layers are guaranteed to |
+ // have transform nodes at this point because they are our ancestors (so |
+ // have already been processed) and are sticky (so have transform nodes). |
+ int shifting_sticky_box_layer_id = |
+ sticky_data->constraints.nearest_layer_shifting_sticky_box; |
+ if (shifting_sticky_box_layer_id != Layer::INVALID_ID) { |
+ DCHECK(data_for_children->property_trees->IsInIdToIndexMap( |
+ PropertyTrees::TreeType::TRANSFORM, shifting_sticky_box_layer_id)); |
+ sticky_data->nearest_node_shifting_sticky_box = |
+ data_for_children->property_trees |
+ ->layer_id_to_transform_node_index[shifting_sticky_box_layer_id]; |
ajuma
2017/03/17 23:59:52
This needs to use TransformTree::FindNodeIndexFrom
smcgruer
2017/03/20 13:36:30
Done.
|
+ } |
+ int shifting_containing_block_layer_id = |
+ sticky_data->constraints.nearest_layer_shifting_containing_block; |
+ if (shifting_containing_block_layer_id != Layer::INVALID_ID) { |
+ DCHECK(data_for_children->property_trees->IsInIdToIndexMap( |
+ PropertyTrees::TreeType::TRANSFORM, |
+ shifting_containing_block_layer_id)); |
+ sticky_data->nearest_node_shifting_containing_block = |
+ data_for_children->property_trees->layer_id_to_transform_node_index |
+ [shifting_containing_block_layer_id]; |
+ } |
} |
node->needs_local_transform_update = true; |