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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2702143002: Refactor IsScrolledBy and IsClosestScrollAncestor to use ScrollNode ids (Closed)
Patch Set: Created 3 years, 10 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/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 75194f6628628b5b8c7a27940422183a691cd0ad..91131a6e4a78cad2d82909adb79182990a570fcf 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -154,8 +154,8 @@ void RecordCompositorSlowScrollMetric(InputHandler::ScrollInputType type,
}
}
-// Return true if scrollable 'ancestor' is the same layer as 'child' or its
-// ancestor along the scroll tree.
+// Return true if scrollable 'ancestor' has the same scroll node as 'child' or
+// an ancestor along the scroll tree.
bool IsScrolledBy(LayerImpl* child, LayerImpl* ancestor) {
DCHECK(ancestor && ancestor->scrollable());
if (!child)
@@ -165,7 +165,7 @@ bool IsScrolledBy(LayerImpl* child, LayerImpl* ancestor) {
child->layer_tree_impl()->property_trees()->scroll_tree;
for (ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index());
scroll_node; scroll_node = scroll_tree.parent(scroll_node)) {
- if (scroll_node->owning_layer_id == ancestor->id())
+ if (scroll_node->id == ancestor->scroll_tree_index())
ajuma 2017/02/21 16:05:25 Just wanted to point out that this could change be
bokan 2017/02/21 19:45:25 Ali, could you help me understand how that could h
ajuma 2017/02/21 20:07:56 Every layer has a scroll_tree_index. If a layer do
bokan 2017/02/21 20:25:22 Ah, got it - I was misunderstanding how that worke
pdr. 2017/02/23 05:44:26 +1, I had the same misunderstanding.
return true;
}
return false;
@@ -2626,7 +2626,7 @@ static bool IsClosestScrollAncestor(LayerImpl* child,
for (; scroll_tree.parent(scroll_node);
scroll_node = scroll_tree.parent(scroll_node)) {
if (scroll_node->scrollable)
- return scroll_node->owning_layer_id == scroll_ancestor->id();
+ return scroll_node->id == scroll_ancestor->scroll_tree_index();
ajuma 2017/02/21 16:05:25 Same comment as above, but this time it looks like
sunxd 2017/02/22 22:25:19 In some cases we have MainThreadScrollingReason::k
}
return false;
}
« 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