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..f0df2c19c19533560f66ec39b6040e21771aeac8 100644 |
--- a/cc/trees/property_tree_builder.cc |
+++ b/cc/trees/property_tree_builder.cc |
@@ -759,10 +759,32 @@ bool AddTransformNodeIfNeeded( |
.AddNodeAffectedByOuterViewportBoundsDelta(node->id); |
} |
} |
+ // This calculation will be incorrect if we have an ancestor sticky element |
+ // that is not composited: 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 x = sticky_data->constraints.nearest_layer_shifting_sticky_box; |
flackr
2017/03/17 18:04:08
nit: Use descriptive variable names
smcgruer
2017/03/17 18:42:42
Done.
|
+ if (x >= 0) { |
flackr
2017/03/17 18:04:08
Compare to the invalid id constant.
smcgruer
2017/03/17 18:42:42
Done.
|
+ DCHECK(data_for_children->property_trees->IsInIdToIndexMap( |
+ PropertyTrees::TreeType::TRANSFORM, x)); |
+ sticky_data->nearest_node_shifting_sticky_box = |
+ data_for_children->property_trees |
+ ->layer_id_to_transform_node_index[x]; |
+ } |
+ int y = sticky_data->constraints.nearest_layer_shifting_containing_block; |
+ if (y >= 0) { |
+ DCHECK(data_for_children->property_trees->IsInIdToIndexMap( |
+ PropertyTrees::TreeType::TRANSFORM, y)); |
+ sticky_data->nearest_node_shifting_containing_block = |
+ data_for_children->property_trees |
+ ->layer_id_to_transform_node_index[y]; |
+ } |
} |
node->needs_local_transform_update = true; |