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

Unified Diff: cc/trees/property_tree_builder.cc

Issue 2698843004: Correct for enclosing layers scroll position in sticky_data->main_thread_offset (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
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..74b2c232cd776defa1e267e70d8fdbe7453f1eff 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -759,10 +759,19 @@ 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.
+ 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_data->main_thread_offset = layer->position().OffsetFromOrigin() -
+ sticky_box_offset.OffsetFromOrigin();
}
node->needs_local_transform_update = true;

Powered by Google App Engine
This is Rietveld 408576698