| 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..9c4866c2d97275c9c9ad1712bee2b098e5fa87a8 100644
|
| --- a/cc/trees/property_tree_builder.cc
|
| +++ b/cc/trees/property_tree_builder.cc
|
| @@ -513,6 +513,20 @@ static inline bool ShouldFlattenTransform(LayerImpl* layer) {
|
| return layer->test_properties()->should_flatten_transform;
|
| }
|
|
|
| +static inline gfx::Vector2dF CalculateTotalStickyOffsetToScroller(
|
| + LayerImpl* layer,
|
| + int scroll_ancestor_layer_id) {
|
| + NOTREACHED();
|
| + return gfx::Vector2dF();
|
| +}
|
| +
|
| +static inline gfx::Vector2dF CalculateTotalStickyOffsetToScroller(
|
| + Layer* layer,
|
| + int scroll_ancestor_layer_id) {
|
| + return draw_property_utils::CalculateTotalStickyOffsetToScroller(
|
| + layer, scroll_ancestor_layer_id);
|
| +}
|
| +
|
| template <typename LayerType>
|
| bool AddTransformNodeIfNeeded(
|
| const DataForRecursion<LayerType>& data_from_ancestor,
|
| @@ -759,10 +773,29 @@ bool AddTransformNodeIfNeeded(
|
| .AddNodeAffectedByOuterViewportBoundsDelta(node->id);
|
| }
|
| }
|
| - sticky_data->main_thread_offset =
|
| - layer->position().OffsetFromOrigin() -
|
| - sticky_data->constraints.parent_relative_sticky_box_offset
|
| - .OffsetFromOrigin();
|
| + // The sticky box offset calculated in CompositedLayerMapping must be
|
| + // adjusted for the enclosing layer's sticky offset.
|
| + gfx::Point sticky_box_offset(
|
| + sticky_data->constraints.parent_relative_sticky_box_offset);
|
| + if (Parent(layer)->id() != scroll_ancestor->owning_layer_id) {
|
| + sticky_box_offset +=
|
| + gfx::ToFlooredVector2d(CalculateTotalStickyOffsetToScroller(
|
| + Parent(layer), scroll_ancestor->owning_layer_id));
|
| + }
|
| + sticky_data->main_thread_offset = layer->position().OffsetFromOrigin() -
|
| + sticky_box_offset.OffsetFromOrigin();
|
| + // Copy the ancestor nodes for later use. These layers are guaranteed to
|
| + // have transform nodes because they are our ancestors and they are sticky.
|
| + if (Layer* layer =
|
| + sticky_data->constraints.nearest_layer_shifting_sticky_box) {
|
| + sticky_data->nearest_node_shifting_sticky_box =
|
| + layer->transform_tree_index();
|
| + }
|
| + if (Layer* layer =
|
| + sticky_data->constraints.nearest_layer_shifting_containing_block) {
|
| + sticky_data->nearest_node_shifting_containing_block =
|
| + layer->transform_tree_index();
|
| + }
|
| }
|
|
|
| node->needs_local_transform_update = true;
|
|
|