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

Unified Diff: cc/trees/property_tree_builder.cc

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Address comments Created 3 years, 7 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 a7efa0a71556ec6e68c77605d7e907fe504f32b3..a7a1af28292c3bd012bbedfe8618ba7cd3da6943 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -76,6 +76,14 @@ static LayerStickyPositionConstraint StickyPositionConstraint(
return layer->test_properties()->sticky_position_constraint;
}
+static gfx::Size StickyMainThreadOffset(Layer* layer) {
+ return layer->sticky_main_thread_offset();
+}
+
+static gfx::Size StickyMainThreadOffset(LayerImpl* layer) {
+ return layer->test_properties()->sticky_main_thread_offset;
+}
+
static LayerImplList& Children(LayerImpl* layer) {
return layer->test_properties()->children;
}
@@ -540,14 +548,6 @@ 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).
@@ -570,6 +570,9 @@ bool AddTransformNodeIfNeeded(
DCHECK(sticky_data->nearest_node_shifting_containing_block !=
TransformTree::kInvalidNodeId);
}
+ node->sticky_main_thread_offset =
+ gfx::Vector2dF(StickyMainThreadOffset(layer).width(),
+ StickyMainThreadOffset(layer).height());
}
node->needs_local_transform_update = true;
« no previous file with comments | « cc/trees/property_tree.cc ('k') | cc/trees/transform_node.h » ('j') | cc/trees/transform_node.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698