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

Unified Diff: cc/trees/property_tree_builder.cc

Issue 2733633002: Handle nested position:sticky elements correctly (compositor) (Closed)
Patch Set: Revert float changes to unittests too Created 3 years, 9 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/trees/property_tree_builder.cc
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
index 8a47496ed92a00e651793897adcb9f8144641271..d30308c857e27e5ca70868a883acab450bde77c3 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -758,10 +758,36 @@ bool AddTransformNodeIfNeeded(
.AddNodeAffectedByOuterViewportBoundsDelta(node->id);
}
}
+ // TODO(smcgruer): Pass main thread sticky-shifting offsets of
+ // non-promoted ancestors, or promote all ancestor sticky elements.
+ // See http://crbug.com/702229
sticky_data->main_thread_offset =
layer->position().OffsetFromOrigin() -
sticky_data->constraints.parent_relative_sticky_box_offset
.OffsetFromOrigin();
+
+ // Copy the ancestor nodes for later use. These layers are guaranteed to
+ // have transform nodes at this point because they are our ancestors (so
+ // have already been processed) and are sticky (so have transform nodes).
+ int shifting_sticky_box_layer_id =
+ sticky_data->constraints.nearest_layer_shifting_sticky_box;
+ if (shifting_sticky_box_layer_id != Layer::INVALID_ID) {
+ sticky_data->nearest_node_shifting_sticky_box =
+ data_for_children->property_trees->transform_tree
+ .FindNodeIndexFromOwningLayerId(shifting_sticky_box_layer_id);
+ DCHECK(sticky_data->nearest_node_shifting_sticky_box !=
+ TransformTree::kInvalidNodeId);
+ }
+ int shifting_containing_block_layer_id =
+ sticky_data->constraints.nearest_layer_shifting_containing_block;
+ if (shifting_containing_block_layer_id != Layer::INVALID_ID) {
+ sticky_data->nearest_node_shifting_containing_block =
+ data_for_children->property_trees->transform_tree
+ .FindNodeIndexFromOwningLayerId(
+ shifting_containing_block_layer_id);
+ DCHECK(sticky_data->nearest_node_shifting_containing_block !=
+ TransformTree::kInvalidNodeId);
+ }
}
node->needs_local_transform_update = true;

Powered by Google App Engine
This is Rietveld 408576698