| Index: cc/trees/property_tree_builder.cc
|
| diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
|
| index 375051ac04087affe87b921490b34eb9c0e83702..7508b87f0429481b9585fc56b4a2c1b211316a37 100644
|
| --- a/cc/trees/property_tree_builder.cc
|
| +++ b/cc/trees/property_tree_builder.cc
|
| @@ -513,6 +513,19 @@ 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) {
|
| + 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 +772,32 @@ 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 scroll position and sticky offset.
|
| + // TODO(smcgruer): Maybe rename parent_relative_sticky_box_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::ScrollOffsetToFlooredVector2d(
|
| + data_for_children->property_trees->scroll_tree.current_scroll_offset(
|
| + 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();
|
| + 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;
|
|
|