Index: cc/layers/layer.cc |
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc |
index 2f6457bb5cccfd927b510c88e0c684a8c67c88fb..6582a8f7167cb2b67bd8676dcef3a678052b753d 100644 |
--- a/cc/layers/layer.cc |
+++ b/cc/layers/layer.cc |
@@ -611,6 +611,15 @@ void Layer::SetPosition(const gfx::PointF& position) { |
TransformNode* transform_node = |
property_trees->transform_tree.Node(transform_tree_index()); |
transform_node->update_post_local_transform(position, transform_origin()); |
+ if (transform_node->sticky_position_constraint_id >= 0) { |
+ StickyPositionNodeData* sticky_data = |
+ property_trees->transform_tree.StickyPositionData( |
+ transform_tree_index()); |
+ sticky_data->main_thread_offset = |
+ position.OffsetFromOrigin() - |
+ sticky_data->constraints.scroll_container_relative_sticky_box_rect |
+ .OffsetFromOrigin(); |
+ } |
transform_node->needs_local_transform_update = true; |
transform_node->transform_changed = true; |
layer_tree_->property_trees()->transform_tree.set_needs_update(true); |
@@ -1109,6 +1118,15 @@ void Layer::SetPositionConstraint(const LayerPositionConstraint& constraint) { |
SetNeedsCommit(); |
} |
+void Layer::SetStickyPositionConstraint( |
+ const LayerStickyPositionConstraint& constraint) { |
+ DCHECK(IsPropertyChangeAllowed()); |
+ if (inputs_.sticky_position_constraint == constraint) |
+ return; |
+ inputs_.sticky_position_constraint = constraint; |
+ SetNeedsCommit(); |
+} |
+ |
static void RunCopyCallbackOnMainThread( |
std::unique_ptr<CopyOutputRequest> request, |
std::unique_ptr<CopyOutputResult> result) { |