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

Unified Diff: cc/trees/property_tree_builder.cc

Issue 2251303003: Implement position: sticky updates on compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and add unit test for impl side sticky position update. Created 4 years, 3 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 be8ad79344b1b7ebff046a8b15ce3b57a02c34cc..4cbdddf079299c60d1a85b7a9973299edda2959c 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -490,6 +490,7 @@ bool AddTransformNodeIfNeeded(
layer == data_from_ancestor.overscroll_elasticity_layer;
const bool is_scrollable = layer->scrollable();
const bool is_fixed = PositionConstraint(layer).is_fixed_position();
+ const bool is_sticky = layer->sticky_position_constraint().is_sticky;
const bool has_significant_transform =
!Transform(layer).IsIdentityOr2DTranslation();
@@ -524,7 +525,7 @@ bool AddTransformNodeIfNeeded(
has_any_transform_animation || has_surface || is_fixed ||
is_page_scale_layer || is_overscroll_elasticity_layer ||
has_proxied_transform_related_property ||
- scroll_child_has_different_target ||
+ scroll_child_has_different_target || is_sticky ||
is_at_boundary_of_3d_rendering_context;
LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer);
@@ -691,6 +692,19 @@ bool AddTransformNodeIfNeeded(
node->local = Transform(layer);
node->update_pre_local_transform(TransformOrigin(layer));
+ if (layer->sticky_position_constraint().is_sticky) {
+ StickyPositionNodeData* sticky_data =
+ data_for_children->property_trees->transform_tree.StickyPositionData(
+ node->id);
+ sticky_data->constraints = layer->sticky_position_constraint();
+ sticky_data->scroll_ancestor = GetScrollParentId(data_from_ancestor, layer);
+ sticky_data->main_thread_offset =
+ layer->position().OffsetFromOrigin() -
+ sticky_data->constraints.absolute_sticky_box_rect.OffsetFromOrigin();
+ } else {
+ data_for_children->property_trees->transform_tree.SetNotSticky(node->id);
+ }
+
node->needs_local_transform_update = true;
data_from_ancestor.property_trees->transform_tree.UpdateTransforms(node->id);

Powered by Google App Engine
This is Rietveld 408576698