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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 DataForRecursion* data_for_children) { | 141 DataForRecursion* data_for_children) { |
142 const bool is_root = !layer->parent(); | 142 const bool is_root = !layer->parent(); |
143 const bool is_page_scale_application_layer = | 143 const bool is_page_scale_application_layer = |
144 layer->parent() && layer->parent() == data_from_ancestor.page_scale_layer; | 144 layer->parent() && layer->parent() == data_from_ancestor.page_scale_layer; |
145 const bool is_scrollable = layer->scrollable(); | 145 const bool is_scrollable = layer->scrollable(); |
146 const bool is_fixed = layer->position_constraint().is_fixed_position(); | 146 const bool is_fixed = layer->position_constraint().is_fixed_position(); |
147 | 147 |
148 const bool has_significant_transform = | 148 const bool has_significant_transform = |
149 !layer->transform().IsIdentityOr2DTranslation(); | 149 !layer->transform().IsIdentityOr2DTranslation(); |
150 | 150 |
151 const bool has_animated_transform = | 151 const bool has_animated_transform = layer->TransformIsAnimating(); |
152 layer->layer_animation_controller()->IsAnimatingProperty( | |
153 Animation::TRANSFORM); | |
154 | 152 |
155 const bool has_surface = !!layer->render_surface(); | 153 const bool has_surface = !!layer->render_surface(); |
156 | 154 |
157 bool requires_node = is_root || is_scrollable || has_significant_transform || | 155 bool requires_node = is_root || is_scrollable || has_significant_transform || |
158 has_animated_transform || has_surface || | 156 has_animated_transform || has_surface || |
159 is_page_scale_application_layer; | 157 is_page_scale_application_layer; |
160 | 158 |
161 Layer* transform_parent = GetTransformParent(data_from_ancestor, layer); | 159 Layer* transform_parent = GetTransformParent(data_from_ancestor, layer); |
162 | 160 |
163 gfx::Vector2dF parent_offset; | 161 gfx::Vector2dF parent_offset; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 layer->ScrollCompensationAdjustment() - node->data.scroll_snap; | 272 layer->ScrollCompensationAdjustment() - node->data.scroll_snap; |
275 return true; | 273 return true; |
276 } | 274 } |
277 | 275 |
278 void AddOpacityNodeIfNeeded(const DataForRecursion& data_from_ancestor, | 276 void AddOpacityNodeIfNeeded(const DataForRecursion& data_from_ancestor, |
279 Layer* layer, | 277 Layer* layer, |
280 DataForRecursion* data_for_children) { | 278 DataForRecursion* data_for_children) { |
281 const bool is_root = !layer->parent(); | 279 const bool is_root = !layer->parent(); |
282 const bool has_transparency = layer->opacity() != 1.f; | 280 const bool has_transparency = layer->opacity() != 1.f; |
283 const bool has_animated_opacity = | 281 const bool has_animated_opacity = |
284 layer->layer_animation_controller()->IsAnimatingProperty( | 282 layer->OpacityIsAnimating() || layer->OpacityCanAnimateOnImplThread(); |
285 Animation::OPACITY) || | |
286 layer->OpacityCanAnimateOnImplThread(); | |
287 bool requires_node = is_root || has_transparency || has_animated_opacity; | 283 bool requires_node = is_root || has_transparency || has_animated_opacity; |
288 | 284 |
289 int parent_id = data_from_ancestor.opacity_tree_parent; | 285 int parent_id = data_from_ancestor.opacity_tree_parent; |
290 | 286 |
291 if (!requires_node) { | 287 if (!requires_node) { |
292 layer->set_opacity_tree_index(parent_id); | 288 layer->set_opacity_tree_index(parent_id); |
293 data_for_children->opacity_tree_parent = parent_id; | 289 data_for_children->opacity_tree_parent = parent_id; |
294 return; | 290 return; |
295 } | 291 } |
296 | 292 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 358 |
363 ClipNode root_clip; | 359 ClipNode root_clip; |
364 root_clip.data.clip = viewport; | 360 root_clip.data.clip = viewport; |
365 root_clip.data.transform_id = 0; | 361 root_clip.data.transform_id = 0; |
366 data_for_recursion.clip_tree_parent = | 362 data_for_recursion.clip_tree_parent = |
367 data_for_recursion.clip_tree->Insert(root_clip, 0); | 363 data_for_recursion.clip_tree->Insert(root_clip, 0); |
368 BuildPropertyTreesInternal(root_layer, data_for_recursion); | 364 BuildPropertyTreesInternal(root_layer, data_for_recursion); |
369 } | 365 } |
370 | 366 |
371 } // namespace cc | 367 } // namespace cc |
OLD | NEW |