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

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: Merge with master and add comments to WebLayerStickyPositionConstraint members. 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
« no previous file with comments | « cc/trees/property_tree.cc ('k') | cc/trees/transform_node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree_builder.cc
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
index 2bfb21b54c1aa0d1d34ff2d4b5f829be3b198b81..4a85210b446311b33752dd2c2b6707dcd179af5f 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -81,6 +81,15 @@ static LayerPositionConstraint PositionConstraint(LayerImpl* layer) {
return layer->test_properties()->position_constraint;
}
+static LayerStickyPositionConstraint StickyPositionConstraint(Layer* layer) {
+ return layer->sticky_position_constraint();
+}
+
+static LayerStickyPositionConstraint StickyPositionConstraint(
+ LayerImpl* layer) {
+ return layer->test_properties()->sticky_position_constraint;
+}
+
struct PreCalculateMetaInformationRecursiveData {
size_t num_unclipped_descendants;
int num_descendants_that_draw_content;
@@ -491,6 +500,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 = StickyPositionConstraint(layer).is_sticky;
const bool has_significant_transform =
!Transform(layer).IsIdentityOr2DTranslation();
@@ -525,7 +535,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);
@@ -692,6 +702,18 @@ bool AddTransformNodeIfNeeded(
node->local = Transform(layer);
node->update_pre_local_transform(TransformOrigin(layer));
+ if (StickyPositionConstraint(layer).is_sticky) {
+ StickyPositionNodeData* sticky_data =
+ data_for_children->property_trees->transform_tree.StickyPositionData(
+ node->id);
+ sticky_data->constraints = StickyPositionConstraint(layer);
+ sticky_data->scroll_ancestor = GetScrollParentId(data_from_ancestor, layer);
+ sticky_data->main_thread_offset =
+ layer->position().OffsetFromOrigin() -
+ sticky_data->constraints.scroll_container_relative_sticky_box_rect
+ .OffsetFromOrigin();
+ }
+
node->needs_local_transform_update = true;
data_from_ancestor.property_trees->transform_tree.UpdateTransforms(node->id);
« no previous file with comments | « cc/trees/property_tree.cc ('k') | cc/trees/transform_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698