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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 | 11 |
| 12 #include "cc/animation/mutable_properties.h" |
12 #include "cc/base/math_util.h" | 13 #include "cc/base/math_util.h" |
13 #include "cc/layers/layer.h" | 14 #include "cc/layers/layer.h" |
14 #include "cc/layers/layer_impl.h" | 15 #include "cc/layers/layer_impl.h" |
15 #include "cc/trees/draw_property_utils.h" | 16 #include "cc/trees/draw_property_utils.h" |
16 #include "cc/trees/layer_tree_host.h" | 17 #include "cc/trees/layer_tree_host.h" |
17 #include "ui/gfx/geometry/point_f.h" | 18 #include "ui/gfx/geometry/point_f.h" |
18 #include "ui/gfx/geometry/vector2d_conversions.h" | 19 #include "ui/gfx/geometry/vector2d_conversions.h" |
19 | 20 |
20 namespace cc { | 21 namespace cc { |
21 | 22 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 const bool has_potentially_animated_transform = | 216 const bool has_potentially_animated_transform = |
216 layer->HasPotentiallyRunningTransformAnimation(); | 217 layer->HasPotentiallyRunningTransformAnimation(); |
217 | 218 |
218 // A transform node is needed even for a finished animation, since differences | 219 // A transform node is needed even for a finished animation, since differences |
219 // in the timing of animation state updates can mean that an animation that's | 220 // in the timing of animation state updates can mean that an animation that's |
220 // in the Finished state at tree-building time on the main thread is still in | 221 // in the Finished state at tree-building time on the main thread is still in |
221 // the Running state right after commit on the compositor thread. | 222 // the Running state right after commit on the compositor thread. |
222 const bool has_any_transform_animation = | 223 const bool has_any_transform_animation = |
223 layer->HasAnyAnimationTargetingProperty(Animation::TRANSFORM); | 224 layer->HasAnyAnimationTargetingProperty(Animation::TRANSFORM); |
224 | 225 |
| 226 const bool has_proxied_transform_related_property = |
| 227 layer->mutable_properties() & MutableProperty::kTransformRelated; |
| 228 |
225 const bool has_surface = created_render_surface; | 229 const bool has_surface = created_render_surface; |
226 | 230 |
227 // A transform node is needed to change the render target for subtree when | 231 // A transform node is needed to change the render target for subtree when |
228 // a scroll child's render target is different from the scroll parent's render | 232 // a scroll child's render target is different from the scroll parent's render |
229 // target. | 233 // target. |
230 const bool scroll_child_has_different_target = | 234 const bool scroll_child_has_different_target = |
231 layer->scroll_parent() && | 235 layer->scroll_parent() && |
232 layer->parent()->effect_tree_index() != | 236 layer->parent()->effect_tree_index() != |
233 layer->scroll_parent()->effect_tree_index(); | 237 layer->scroll_parent()->effect_tree_index(); |
234 | 238 |
235 bool requires_node = is_root || is_scrollable || has_significant_transform || | 239 bool requires_node = is_root || is_scrollable || has_significant_transform || |
236 has_any_transform_animation || has_surface || is_fixed || | 240 has_any_transform_animation || has_surface || is_fixed || |
237 is_page_scale_layer || is_overscroll_elasticity_layer || | 241 is_page_scale_layer || is_overscroll_elasticity_layer || |
| 242 has_proxied_transform_related_property || |
238 scroll_child_has_different_target; | 243 scroll_child_has_different_target; |
239 | 244 |
240 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); | 245 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); |
241 DCHECK(is_root || transform_parent); | 246 DCHECK(is_root || transform_parent); |
242 | 247 |
243 int parent_index = kRootPropertyTreeNodeId; | 248 int parent_index = kRootPropertyTreeNodeId; |
244 if (transform_parent) | 249 if (transform_parent) |
245 parent_index = transform_parent->transform_tree_index(); | 250 parent_index = transform_parent->transform_tree_index(); |
246 | 251 |
247 int source_index = parent_index; | 252 int source_index = parent_index; |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 } | 557 } |
553 | 558 |
554 template <typename LayerType> | 559 template <typename LayerType> |
555 bool AddEffectNodeIfNeeded( | 560 bool AddEffectNodeIfNeeded( |
556 const DataForRecursion<LayerType>& data_from_ancestor, | 561 const DataForRecursion<LayerType>& data_from_ancestor, |
557 LayerType* layer, | 562 LayerType* layer, |
558 DataForRecursion<LayerType>* data_for_children) { | 563 DataForRecursion<LayerType>* data_for_children) { |
559 const bool is_root = !layer->parent(); | 564 const bool is_root = !layer->parent(); |
560 const bool has_transparency = layer->opacity() != 1.f; | 565 const bool has_transparency = layer->opacity() != 1.f; |
561 const bool has_animated_opacity = IsAnimatingOpacity(layer); | 566 const bool has_animated_opacity = IsAnimatingOpacity(layer); |
| 567 const bool has_proxied_opacity = |
| 568 layer->mutable_properties() & MutableProperty::kOpacity; |
562 const bool should_create_render_surface = ShouldCreateRenderSurface( | 569 const bool should_create_render_surface = ShouldCreateRenderSurface( |
563 layer, data_from_ancestor.compound_transform_since_render_target, | 570 layer, data_from_ancestor.compound_transform_since_render_target, |
564 data_from_ancestor.axis_align_since_render_target); | 571 data_from_ancestor.axis_align_since_render_target); |
565 data_for_children->axis_align_since_render_target &= | 572 data_for_children->axis_align_since_render_target &= |
566 layer->AnimationsPreserveAxisAlignment(); | 573 layer->AnimationsPreserveAxisAlignment(); |
567 | 574 |
568 bool requires_node = is_root || has_transparency || has_animated_opacity || | 575 bool requires_node = is_root || has_transparency || has_animated_opacity || |
569 should_create_render_surface; | 576 has_proxied_opacity || should_create_render_surface; |
570 | 577 |
571 int parent_id = data_from_ancestor.effect_tree_parent; | 578 int parent_id = data_from_ancestor.effect_tree_parent; |
572 | 579 |
573 if (!requires_node) { | 580 if (!requires_node) { |
574 layer->SetEffectTreeIndex(parent_id); | 581 layer->SetEffectTreeIndex(parent_id); |
575 data_for_children->effect_tree_parent = parent_id; | 582 data_for_children->effect_tree_parent = parent_id; |
576 data_for_children->compound_transform_since_render_target *= | 583 data_for_children->compound_transform_since_render_target *= |
577 layer->transform(); | 584 layer->transform(); |
578 return false; | 585 return false; |
579 } | 586 } |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 const gfx::Transform& device_transform, | 814 const gfx::Transform& device_transform, |
808 PropertyTrees* property_trees) { | 815 PropertyTrees* property_trees) { |
809 BuildPropertyTreesTopLevelInternal( | 816 BuildPropertyTreesTopLevelInternal( |
810 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 817 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
811 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 818 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
812 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 819 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
813 device_transform, property_trees); | 820 device_transform, property_trees); |
814 } | 821 } |
815 | 822 |
816 } // namespace cc | 823 } // namespace cc |
OLD | NEW |