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

Unified Diff: cc/layers/layer.cc

Issue 2911463002: Unify the calculation of main thread offset of sticky element (Closed)
Patch Set: Remove parent_relative_sticky_box_offset related logic 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/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index d3100f3daa802322ca072e5be186709b65020bce..c20a6d03380a1f2bb389ccd43f3719f1f91cb556 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -597,18 +597,6 @@ void Layer::SetPosition(const gfx::PointF& position) {
property_trees->transform_tree.UpdateNodeFromOwningLayerId(id())) {
DCHECK_EQ(transform_tree_index(), transform_node->id);
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());
- // 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 =
- position.OffsetFromOrigin() -
- sticky_data->constraints.parent_relative_sticky_box_offset
- .OffsetFromOrigin();
- }
transform_node->needs_local_transform_update = true;
transform_node->transform_changed = true;
layer_tree_host_->property_trees()->transform_tree.set_needs_update(true);
@@ -1108,6 +1096,15 @@ void Layer::SetStickyPositionConstraint(
SetNeedsCommit();
}
+void Layer::SetStickyMainThreadOffset(const gfx::Size& offset) {
+ DCHECK(IsPropertyChangeAllowed());
+ if (inputs_.sticky_main_thread_offset == offset)
+ return;
+ inputs_.sticky_main_thread_offset = offset;
+ SetPropertyTreesNeedRebuild();
smcgruer 2017/05/26 17:14:12 Do we definitely need to rebuild property trees he
yigu 2017/05/26 18:04:21 We don't need to rebuild the tree. Done.
+ SetNeedsCommit();
+}
+
static void RunCopyCallbackOnMainThread(
std::unique_ptr<CopyOutputRequest> request,
std::unique_ptr<CopyOutputResult> result) {

Powered by Google App Engine
This is Rietveld 408576698