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

Unified Diff: cc/trees/property_tree_builder.cc

Issue 2787843004: Attempt to simplify source_index calculation (Closed)
Patch Set: Cleanup Created 3 years, 9 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_builder.cc
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
index 590297d669dd558d8b60d508a4d63d8d0e40703a..19a35342439dfc2ed6214ae000b86fcb9df3ee4c 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -537,29 +537,21 @@ bool AddTransformNodeIfNeeded(
scroll_child_has_different_target || is_sticky ||
is_at_boundary_of_3d_rendering_context;
- LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer);
- DCHECK(is_root || transform_parent);
-
int parent_index = TransformTree::kRootNodeId;
- if (transform_parent)
- parent_index = transform_parent->transform_tree_index();
-
int source_index = parent_index;
weiliangc 2017/03/31 17:44:48 nit: I think it's cleaner if source_index is initi
smcgruer 2017/03/31 17:48:15 Done.
-
gfx::Vector2dF source_offset;
+
+ LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer);
+ DCHECK_EQ(is_root, !transform_parent);
+
if (transform_parent) {
- if (ScrollParent(layer)) {
- LayerType* source = Parent(layer);
- source_offset += source->offset_to_transform_parent();
- source_index = source->transform_tree_index();
- } else if (!is_fixed) {
- source_offset = transform_parent->offset_to_transform_parent();
- } else {
- source_offset = data_from_ancestor.transform_tree_parent
- ->offset_to_transform_parent();
- source_index =
- data_from_ancestor.transform_tree_parent->transform_tree_index();
- }
+ parent_index = transform_parent->transform_tree_index();
+ // Because Blink still provides positions with respect to the parent layer,
+ // we track both a parent TransformNode (which is the parent in the
+ // TransformTree) and a 'source' TransformNode (which is the TransformNode
+ // for the parent in the Layer tree).
+ source_index = Parent(layer)->transform_tree_index();
+ source_offset = Parent(layer)->offset_to_transform_parent();
}
if (IsContainerForFixedPositionLayers(layer) || is_root) {
« 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