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

Unified Diff: cc/layers/layer.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/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_);
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | cc/layers/layer_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698