Index: cc/layers/layer.cc |
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc |
index 6f076f525e32a09e1692cc135eee42603116def1..40dbb2ca226e4298d0bd401e91a8d5393b277368 100644 |
--- a/cc/layers/layer.cc |
+++ b/cc/layers/layer.cc |
@@ -611,6 +611,14 @@ 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.absolute_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 +1117,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) { |
@@ -1167,6 +1184,7 @@ void Layer::PushPropertiesTo(LayerImpl* layer) { |
layer->set_should_flatten_transform_from_property_tree( |
should_flatten_transform_from_property_tree_); |
layer->set_draw_blend_mode(draw_blend_mode_); |
+ layer->SetStickyPositionConstraint(inputs_.sticky_position_constraint); |
layer->SetUseParentBackfaceVisibility(inputs_.use_parent_backface_visibility); |
layer->SetUseLocalTransformForBackfaceVisibility( |
use_local_transform_for_backface_visibility_); |