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

Unified Diff: cc/trees/property_tree.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.cc
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index f450baa7067a5b3aa83fa9b6f08a201f17eb2e24..7fe6f360a987c7d3a26a8948605c76df543d5820 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -372,7 +372,6 @@ gfx::Vector2dF StickyPositionOffset(TransformTree* tree, TransformNode* node) {
scroll_position,
gfx::SizeF(property_trees.scroll_tree.scroll_clip_layer_bounds(
scroll_node->id)));
- gfx::Vector2dF layer_offset(sticky_data->main_thread_offset);
gfx::Vector2dF ancestor_sticky_box_offset;
if (sticky_data->nearest_node_shifting_sticky_box !=
@@ -457,7 +456,11 @@ gfx::Vector2dF StickyPositionOffset(TransformTree* tree, TransformNode* node) {
ancestor_sticky_box_offset + ancestor_containing_block_offset +
sticky_offset - sticky_box_rect.OffsetFromOrigin();
- return sticky_offset - layer_offset - node->source_to_parent -
+ gfx::Vector2dF sticky_main_thread_offset(
flackr 2017/05/31 14:08:22 Rather than converting to a Vector2dF every time,
yigu 2017/06/01 15:15:19 Done.
+ node->sticky_main_thread_offset.width(),
+ node->sticky_main_thread_offset.height());
+
+ return sticky_offset - sticky_main_thread_offset -
sticky_box_rect.OffsetFromOrigin();
}

Powered by Google App Engine
This is Rietveld 408576698