OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/property_tree_builder.h" | 5 #include "cc/trees/property_tree_builder.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 has_significant_transform || has_animated_transform || | 132 has_significant_transform || has_animated_transform || |
133 is_page_scale_application_layer || flattening_change || | 133 is_page_scale_application_layer || flattening_change || |
134 has_surface; | 134 has_surface; |
135 | 135 |
136 Layer* transform_parent = GetTransformParent(data_from_ancestor, layer); | 136 Layer* transform_parent = GetTransformParent(data_from_ancestor, layer); |
137 | 137 |
138 // May be non-zero if layer is fixed or has a scroll parent. | 138 // May be non-zero if layer is fixed or has a scroll parent. |
139 gfx::Vector2dF parent_offset; | 139 gfx::Vector2dF parent_offset; |
140 if (transform_parent) { | 140 if (transform_parent) { |
141 // TODO(vollick): This is to mimic existing bugs (crbug.com/441447). | 141 // TODO(vollick): This is to mimic existing bugs (crbug.com/441447). |
142 if (!is_fixed) | 142 if (!is_fixed) { |
143 parent_offset = transform_parent->offset_to_transform_parent(); | 143 parent_offset = transform_parent->offset_to_transform_parent(); |
| 144 } else if (data_from_ancestor.transform_tree_parent != |
| 145 data_from_ancestor.transform_fixed_parent) { |
| 146 gfx::Vector2dF fixed_offset = data_from_ancestor.transform_tree_parent |
| 147 ->offset_to_transform_parent(); |
| 148 gfx::Transform parent_to_parent; |
| 149 data_from_ancestor.transform_tree->ComputeTransform( |
| 150 data_from_ancestor.transform_tree_parent->transform_tree_index(), |
| 151 data_from_ancestor.transform_fixed_parent->transform_tree_index(), |
| 152 &parent_to_parent); |
| 153 |
| 154 fixed_offset += parent_to_parent.To2dTranslation(); |
| 155 parent_offset += fixed_offset; |
| 156 } |
144 | 157 |
145 gfx::Transform to_parent; | 158 gfx::Transform to_parent; |
146 Layer* source = data_from_ancestor.transform_tree_parent; | 159 Layer* source = data_from_ancestor.transform_tree_parent; |
147 if (layer->scroll_parent()) { | 160 if (layer->scroll_parent()) { |
148 source = layer->parent(); | 161 source = layer->parent(); |
149 parent_offset += layer->parent()->offset_to_transform_parent(); | 162 parent_offset += layer->parent()->offset_to_transform_parent(); |
150 } | 163 } |
151 data_from_ancestor.transform_tree->ComputeTransform( | 164 data_from_ancestor.transform_tree->ComputeTransform( |
152 source->transform_tree_index(), | 165 source->transform_tree_index(), |
153 transform_parent->transform_tree_index(), &to_parent); | 166 transform_parent->transform_tree_index(), &to_parent); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 data_for_recursion.device_transform = &device_transform; | 320 data_for_recursion.device_transform = &device_transform; |
308 | 321 |
309 ClipNode root_clip; | 322 ClipNode root_clip; |
310 root_clip.data.clip = viewport; | 323 root_clip.data.clip = viewport; |
311 root_clip.data.transform_id = 0; | 324 root_clip.data.transform_id = 0; |
312 data_for_recursion.clip_tree_parent = clip_tree->Insert(root_clip, 0); | 325 data_for_recursion.clip_tree_parent = clip_tree->Insert(root_clip, 0); |
313 BuildPropertyTreesInternal(root_layer, data_for_recursion); | 326 BuildPropertyTreesInternal(root_layer, data_for_recursion); |
314 } | 327 } |
315 | 328 |
316 } // namespace cc | 329 } // namespace cc |
OLD | NEW |