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

Unified Diff: cc/trees/property_tree.cc

Issue 2874793004: Remove one use of ScrollNode's owning_layer_id for StickyPositionOffset (Closed)
Patch Set: DCHECK that the scroll offset values are unchanged 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree.cc
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index fbedc16878b0cfe83a49df79688311b9513bdcab..350a4299727118b5452b47e26c8c63000f9ea3fd 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -352,24 +352,25 @@ gfx::Vector2dF StickyPositionOffset(TransformTree* tree, TransformNode* node) {
return gfx::Vector2dF();
StickyPositionNodeData* sticky_data = tree->StickyPositionData(node->id);
const LayerStickyPositionConstraint& constraint = sticky_data->constraints;
+ auto& property_trees = *tree->property_trees();
ScrollNode* scroll_node =
- tree->property_trees()->scroll_tree.Node(sticky_data->scroll_ancestor);
- gfx::ScrollOffset scroll_offset =
- tree->property_trees()->scroll_tree.current_scroll_offset(
- scroll_node->owning_layer_id);
+ property_trees.scroll_tree.Node(sticky_data->scroll_ancestor);
+ TransformNode* transform_node =
+ property_trees.transform_tree.Node(scroll_node->transform_id);
+ const auto& scroll_offset = transform_node->scroll_offset;
+ DCHECK(property_trees.scroll_tree.current_scroll_offset(
chrishtr 2017/05/12 22:11:20 Add a note that this can be removed later, and is
enne (OOO) 2017/05/12 22:15:28 Can you DCHECK_EQ this?
+ scroll_node->owning_layer_id) == scroll_offset);
gfx::PointF scroll_position(scroll_offset.x(), scroll_offset.y());
- TransformNode* scroll_ancestor_transform_node =
- tree->Node(scroll_node->transform_id);
- if (scroll_ancestor_transform_node->scrolls) {
+ if (transform_node->scrolls) {
// The scroll position does not include snapping which shifts the scroll
// offset to align to a pixel boundary, we need to manually include it here.
// In this case, snapping is caused by a scroll.
- scroll_position -= scroll_ancestor_transform_node->snap_amount;
+ scroll_position -= transform_node->snap_amount;
}
gfx::RectF clip(
scroll_position,
- gfx::SizeF(tree->property_trees()->scroll_tree.scroll_clip_layer_bounds(
+ gfx::SizeF(property_trees.scroll_tree.scroll_clip_layer_bounds(
scroll_node->id)));
gfx::Vector2dF layer_offset(sticky_data->main_thread_offset);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698