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

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: 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/layers/layer.h ('k') | cc/layers/layer_impl_test_properties.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl_test_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698