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

Unified Diff: cc/trees/property_tree.cc

Issue 2183923002: Undo scroll snaps in to_parent when NeedsSourceToParentUpdate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit change Created 4 years, 5 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 | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/property_tree_builder.cc » ('j') | 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 12e42508beb4fbf3146215d675ecbebf7ff48e3f..109dfc5af8582f71e4970fffae4566cb1a6b053c 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -337,6 +337,28 @@ void TransformTree::UpdateLocalTransform(TransformNode* node) {
if (NeedsSourceToParentUpdate(node)) {
gfx::Transform to_parent;
ComputeTranslation(node->source_node_id, node->parent_id, &to_parent);
+ gfx::Vector2dF unsnapping;
+ TransformNode* current;
+ TransformNode* parent_node;
+ for (current = Node(node->source_node_id); current->id > node->parent_id;
+ current = parent(current)) {
+ unsnapping.Subtract(current->scroll_snap);
+ }
+ for (parent_node = Node(node->parent_id);
+ parent_node->id > node->source_node_id;
+ parent_node = parent(parent_node)) {
+ unsnapping.Add(parent_node->scroll_snap);
+ }
+ // If a node NeedsSourceToParentUpdate, the node is either a fixed position
+ // node or a scroll child.
+ // If the node has a fixed position, the parent of the node is an ancestor
+ // of source node, current->id should be equal to node->parent_id.
+ // Otherwise, the node's source node is always an ancestor of the node owned
+ // by the scroll parent, so parent_node->id should be equal to
+ // node->source_node_id.
+ DCHECK(current->id == node->parent_id ||
+ parent_node->id == node->source_node_id);
+ to_parent.Translate(unsnapping.x(), unsnapping.y());
node->source_to_parent = to_parent.To2dTranslation();
}
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698