| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 const bool has_animated_transform = | 121 const bool has_animated_transform = |
| 122 layer->layer_animation_controller()->IsAnimatingProperty( | 122 layer->layer_animation_controller()->IsAnimatingProperty( |
| 123 Animation::TRANSFORM); | 123 Animation::TRANSFORM); |
| 124 | 124 |
| 125 const bool has_surface = !!layer->render_surface(); | 125 const bool has_surface = !!layer->render_surface(); |
| 126 | 126 |
| 127 const bool flattening_change = layer->parent() && | 127 const bool flattening_change = layer->parent() && |
| 128 layer->should_flatten_transform() && | 128 layer->should_flatten_transform() && |
| 129 !layer->parent()->should_flatten_transform(); | 129 !layer->parent()->should_flatten_transform(); |
| 130 | 130 |
| 131 bool requires_node = is_root || is_scrollable || is_fixed || | 131 bool requires_node = is_root || is_scrollable || has_significant_transform || |
| 132 has_significant_transform || has_animated_transform || | 132 has_animated_transform || has_surface || |
| 133 is_page_scale_application_layer || flattening_change || | 133 is_page_scale_application_layer || flattening_change; |
| 134 has_surface; | |
| 135 | 134 |
| 136 Layer* transform_parent = GetTransformParent(data_from_ancestor, layer); | 135 Layer* transform_parent = GetTransformParent(data_from_ancestor, layer); |
| 137 | 136 |
| 138 // May be non-zero if layer is fixed or has a scroll parent. | 137 // May be non-zero if layer is fixed or has a scroll parent. |
| 139 gfx::Vector2dF parent_offset; | 138 gfx::Vector2dF parent_offset; |
| 140 if (transform_parent) { | 139 if (transform_parent) { |
| 141 // TODO(vollick): This is to mimic existing bugs (crbug.com/441447). | 140 // TODO(vollick): This is to mimic existing bugs (crbug.com/441447). |
| 142 if (!is_fixed) | 141 if (!is_fixed) { |
| 143 parent_offset = transform_parent->offset_to_transform_parent(); | 142 parent_offset = transform_parent->offset_to_transform_parent(); |
| 143 } else if (data_from_ancestor.transform_tree_parent != |
| 144 data_from_ancestor.transform_fixed_parent) { |
| 145 gfx::Vector2dF fixed_offset = data_from_ancestor.transform_tree_parent |
| 146 ->offset_to_transform_parent(); |
| 147 gfx::Transform parent_to_parent; |
| 148 data_from_ancestor.transform_tree->ComputeTransform( |
| 149 data_from_ancestor.transform_tree_parent->transform_tree_index(), |
| 150 data_from_ancestor.transform_fixed_parent->transform_tree_index(), |
| 151 &parent_to_parent); |
| 152 |
| 153 fixed_offset += parent_to_parent.To2dTranslation(); |
| 154 parent_offset += fixed_offset; |
| 155 } |
| 144 | 156 |
| 145 gfx::Transform to_parent; | 157 gfx::Transform to_parent; |
| 146 Layer* source = data_from_ancestor.transform_tree_parent; | 158 Layer* source = data_from_ancestor.transform_tree_parent; |
| 147 if (layer->scroll_parent()) { | 159 if (layer->scroll_parent()) { |
| 148 source = layer->parent(); | 160 source = layer->parent(); |
| 149 parent_offset += layer->parent()->offset_to_transform_parent(); | 161 parent_offset += layer->parent()->offset_to_transform_parent(); |
| 150 } | 162 } |
| 151 data_from_ancestor.transform_tree->ComputeTransform( | 163 data_from_ancestor.transform_tree->ComputeTransform( |
| 152 source->transform_tree_index(), | 164 source->transform_tree_index(), |
| 153 transform_parent->transform_tree_index(), &to_parent); | 165 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; | 319 data_for_recursion.device_transform = &device_transform; |
| 308 | 320 |
| 309 ClipNode root_clip; | 321 ClipNode root_clip; |
| 310 root_clip.data.clip = viewport; | 322 root_clip.data.clip = viewport; |
| 311 root_clip.data.transform_id = 0; | 323 root_clip.data.transform_id = 0; |
| 312 data_for_recursion.clip_tree_parent = clip_tree->Insert(root_clip, 0); | 324 data_for_recursion.clip_tree_parent = clip_tree->Insert(root_clip, 0); |
| 313 BuildPropertyTreesInternal(root_layer, data_for_recursion); | 325 BuildPropertyTreesInternal(root_layer, data_for_recursion); |
| 314 } | 326 } |
| 315 | 327 |
| 316 } // namespace cc | 328 } // namespace cc |
| OLD | NEW |