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 29 matching lines...) Expand all Loading... |
40 const LayerType* overscroll_elasticity_layer; | 40 const LayerType* overscroll_elasticity_layer; |
41 gfx::Vector2dF elastic_overscroll; | 41 gfx::Vector2dF elastic_overscroll; |
42 float page_scale_factor; | 42 float page_scale_factor; |
43 bool in_subtree_of_page_scale_layer; | 43 bool in_subtree_of_page_scale_layer; |
44 bool affected_by_inner_viewport_bounds_delta; | 44 bool affected_by_inner_viewport_bounds_delta; |
45 bool affected_by_outer_viewport_bounds_delta; | 45 bool affected_by_outer_viewport_bounds_delta; |
46 bool should_flatten; | 46 bool should_flatten; |
47 bool target_is_clipped; | 47 bool target_is_clipped; |
48 const gfx::Transform* device_transform; | 48 const gfx::Transform* device_transform; |
49 gfx::Vector2dF scroll_compensation_adjustment; | 49 gfx::Vector2dF scroll_compensation_adjustment; |
| 50 gfx::Transform compound_transform_since_render_target; |
| 51 bool axis_align_since_render_target; |
50 int sequence_number; | 52 int sequence_number; |
51 }; | 53 }; |
52 | 54 |
53 template <typename LayerType> | 55 template <typename LayerType> |
54 static LayerType* GetTransformParent(const DataForRecursion<LayerType>& data, | 56 static LayerType* GetTransformParent(const DataForRecursion<LayerType>& data, |
55 LayerType* layer) { | 57 LayerType* layer) { |
56 return layer->position_constraint().is_fixed_position() | 58 return layer->position_constraint().is_fixed_position() |
57 ? data.transform_fixed_parent | 59 ? data.transform_fixed_parent |
58 : data.transform_tree_parent; | 60 : data.transform_tree_parent; |
59 } | 61 } |
60 | 62 |
61 template <typename LayerType> | 63 template <typename LayerType> |
62 static ClipNode* GetClipParent(const DataForRecursion<LayerType>& data, | 64 static ClipNode* GetClipParent(const DataForRecursion<LayerType>& data, |
63 LayerType* layer) { | 65 LayerType* layer) { |
64 const bool inherits_clip = !layer->parent() || !layer->clip_parent(); | 66 const bool inherits_clip = !layer->parent() || !layer->clip_parent(); |
65 const int id = inherits_clip ? data.clip_tree_parent | 67 const int id = inherits_clip ? data.clip_tree_parent |
66 : layer->clip_parent()->clip_tree_index(); | 68 : layer->clip_parent()->clip_tree_index(); |
67 return data.clip_tree->Node(id); | 69 return data.clip_tree->Node(id); |
68 } | 70 } |
69 | 71 |
70 template <typename LayerType> | 72 template <typename LayerType> |
71 static bool AppliesClip(LayerType* layer, | 73 static bool AppliesClip(LayerType* layer, |
72 const DataForRecursion<LayerType>& data, | 74 const DataForRecursion<LayerType>& data, |
| 75 bool created_render_surface, |
73 bool is_clipped) { | 76 bool is_clipped) { |
74 const bool render_surface_applies_clip = | 77 const bool render_surface_applies_clip = created_render_surface && is_clipped; |
75 layer->has_render_surface() && is_clipped; | |
76 const bool render_surface_may_grow_due_to_clip_children = | 78 const bool render_surface_may_grow_due_to_clip_children = |
77 layer->has_render_surface() && layer->num_unclipped_descendants() > 0; | 79 created_render_surface && layer->num_unclipped_descendants() > 0; |
78 | 80 |
79 if (layer->masks_to_bounds() || layer->mask_layer() || | 81 if (layer->masks_to_bounds() || layer->mask_layer() || |
80 render_surface_may_grow_due_to_clip_children) | 82 render_surface_may_grow_due_to_clip_children) |
81 return true; | 83 return true; |
82 | 84 |
83 if (!render_surface_applies_clip) | 85 if (!render_surface_applies_clip) |
84 return false; | 86 return false; |
85 | 87 |
86 return true; | 88 return true; |
87 } | 89 } |
(...skipping 13 matching lines...) Expand all Loading... |
101 int parent_id = parent->id; | 103 int parent_id = parent->id; |
102 | 104 |
103 bool is_root = !layer->parent(); | 105 bool is_root = !layer->parent(); |
104 | 106 |
105 // Whether we have an ancestor clip that we might need to apply. | 107 // Whether we have an ancestor clip that we might need to apply. |
106 bool ancestor_clips_subtree = is_root || parent->data.layers_are_clipped; | 108 bool ancestor_clips_subtree = is_root || parent->data.layers_are_clipped; |
107 | 109 |
108 bool layers_are_clipped = false; | 110 bool layers_are_clipped = false; |
109 bool has_unclipped_surface = false; | 111 bool has_unclipped_surface = false; |
110 | 112 |
111 if (layer->has_render_surface()) { | 113 if (created_render_surface) { |
112 // Clips can usually be applied to a surface's descendants simply by | 114 // Clips can usually be applied to a surface's descendants simply by |
113 // clipping the surface (or applied implicitly by the surface's bounds). | 115 // clipping the surface (or applied implicitly by the surface's bounds). |
114 // However, if the surface has unclipped descendants (layers that aren't | 116 // However, if the surface has unclipped descendants (layers that aren't |
115 // affected by the ancestor clip), we cannot clip the surface itself, and | 117 // affected by the ancestor clip), we cannot clip the surface itself, and |
116 // must instead apply clips to the clipped descendants. | 118 // must instead apply clips to the clipped descendants. |
117 if (ancestor_clips_subtree && layer->num_unclipped_descendants() > 0) { | 119 if (ancestor_clips_subtree && layer->num_unclipped_descendants() > 0) { |
118 layers_are_clipped = true; | 120 layers_are_clipped = true; |
119 } else if (!ancestor_clips_subtree) { | 121 } else if (!ancestor_clips_subtree) { |
120 // When there are no ancestor clips that need to be applied to a render | 122 // When there are no ancestor clips that need to be applied to a render |
121 // surface, we reset clipping state. The surface might contribute a clip | 123 // surface, we reset clipping state. The surface might contribute a clip |
(...skipping 18 matching lines...) Expand all Loading... |
140 if (layer_clips_subtree) | 142 if (layer_clips_subtree) |
141 layers_are_clipped = true; | 143 layers_are_clipped = true; |
142 | 144 |
143 // Without surfaces, all non-viewport clips have to be applied using layer | 145 // Without surfaces, all non-viewport clips have to be applied using layer |
144 // clipping. | 146 // clipping. |
145 bool layers_are_clipped_when_surfaces_disabled = | 147 bool layers_are_clipped_when_surfaces_disabled = |
146 layer_clips_subtree || | 148 layer_clips_subtree || |
147 parent->data.layers_are_clipped_when_surfaces_disabled; | 149 parent->data.layers_are_clipped_when_surfaces_disabled; |
148 | 150 |
149 bool applies_clip = | 151 bool applies_clip = |
150 AppliesClip(layer, data_from_ancestor, ancestor_clips_subtree); | 152 AppliesClip(layer, data_from_ancestor, created_render_surface, |
| 153 ancestor_clips_subtree); |
151 bool parent_applies_clip = !parent->data.resets_clip; | 154 bool parent_applies_clip = !parent->data.resets_clip; |
152 | 155 |
153 // When we have an unclipped surface, all ancestor clips no longer apply. | 156 // When we have an unclipped surface, all ancestor clips no longer apply. |
154 // However, if our parent already clears ancestor clips and applies no clip of | 157 // However, if our parent already clears ancestor clips and applies no clip of |
155 // its own, there aren't any ancestor clips that need clearing. | 158 // its own, there aren't any ancestor clips that need clearing. |
156 bool needs_to_clear_ancestor_clips = | 159 bool needs_to_clear_ancestor_clips = |
157 has_unclipped_surface && parent_applies_clip; | 160 has_unclipped_surface && parent_applies_clip; |
158 bool requires_node = applies_clip || needs_to_clear_ancestor_clips; | 161 bool requires_node = applies_clip || needs_to_clear_ancestor_clips; |
159 | 162 |
160 if (!requires_node) { | 163 if (!requires_node) { |
(...skipping 14 matching lines...) Expand all Loading... |
175 node.data.transform_id = transform_parent->transform_tree_index(); | 178 node.data.transform_id = transform_parent->transform_tree_index(); |
176 node.data.target_id = | 179 node.data.target_id = |
177 data_for_children->effect_tree->Node(data_for_children->render_target) | 180 data_for_children->effect_tree->Node(data_for_children->render_target) |
178 ->data.transform_id; | 181 ->data.transform_id; |
179 node.owner_id = layer->id(); | 182 node.owner_id = layer->id(); |
180 | 183 |
181 if (ancestor_clips_subtree || layer_clips_subtree) { | 184 if (ancestor_clips_subtree || layer_clips_subtree) { |
182 // Surfaces reset the rect used for layer clipping. At other nodes, layer | 185 // Surfaces reset the rect used for layer clipping. At other nodes, layer |
183 // clipping state from ancestors must continue to get propagated. | 186 // clipping state from ancestors must continue to get propagated. |
184 node.data.layer_clipping_uses_only_local_clip = | 187 node.data.layer_clipping_uses_only_local_clip = |
185 layer->has_render_surface() || !ancestor_clips_subtree; | 188 created_render_surface || !ancestor_clips_subtree; |
186 } else { | 189 } else { |
187 // Otherwise, we're either unclipped, or exist only in order to apply our | 190 // Otherwise, we're either unclipped, or exist only in order to apply our |
188 // parent's clips in our space. | 191 // parent's clips in our space. |
189 node.data.layer_clipping_uses_only_local_clip = false; | 192 node.data.layer_clipping_uses_only_local_clip = false; |
190 } | 193 } |
191 | 194 |
192 node.data.applies_local_clip = layer_clips_subtree; | 195 node.data.applies_local_clip = layer_clips_subtree; |
193 node.data.resets_clip = has_unclipped_surface; | 196 node.data.resets_clip = has_unclipped_surface; |
194 node.data.target_is_clipped = data_for_children->target_is_clipped; | 197 node.data.target_is_clipped = data_for_children->target_is_clipped; |
195 node.data.layers_are_clipped = layers_are_clipped; | 198 node.data.layers_are_clipped = layers_are_clipped; |
196 node.data.layers_are_clipped_when_surfaces_disabled = | 199 node.data.layers_are_clipped_when_surfaces_disabled = |
197 layers_are_clipped_when_surfaces_disabled; | 200 layers_are_clipped_when_surfaces_disabled; |
198 | 201 |
199 data_for_children->clip_tree_parent = | 202 data_for_children->clip_tree_parent = |
200 data_for_children->clip_tree->Insert(node, parent_id); | 203 data_for_children->clip_tree->Insert(node, parent_id); |
201 } | 204 } |
202 | 205 |
203 layer->SetClipTreeIndex(data_for_children->clip_tree_parent); | 206 layer->SetClipTreeIndex(data_for_children->clip_tree_parent); |
204 | |
205 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the | 207 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the |
206 // clip for all children since we may need to draw. We need to figure out a | 208 // clip for all children since we may need to draw. We need to figure out a |
207 // better way, since we will need both the clipped and unclipped versions. | 209 // better way, since we will need both the clipped and unclipped versions. |
208 } | 210 } |
209 | 211 |
210 template <typename LayerType> | 212 template <typename LayerType> |
211 bool AddTransformNodeIfNeeded( | 213 bool AddTransformNodeIfNeeded( |
212 const DataForRecursion<LayerType>& data_from_ancestor, | 214 const DataForRecursion<LayerType>& data_from_ancestor, |
213 LayerType* layer, | 215 LayerType* layer, |
214 bool created_render_surface, | 216 bool created_render_surface, |
(...skipping 11 matching lines...) Expand all Loading... |
226 const bool has_potentially_animated_transform = | 228 const bool has_potentially_animated_transform = |
227 layer->HasPotentiallyRunningTransformAnimation(); | 229 layer->HasPotentiallyRunningTransformAnimation(); |
228 | 230 |
229 // A transform node is needed even for a finished animation, since differences | 231 // A transform node is needed even for a finished animation, since differences |
230 // in the timing of animation state updates can mean that an animation that's | 232 // in the timing of animation state updates can mean that an animation that's |
231 // in the Finished state at tree-building time on the main thread is still in | 233 // in the Finished state at tree-building time on the main thread is still in |
232 // the Running state right after commit on the compositor thread. | 234 // the Running state right after commit on the compositor thread. |
233 const bool has_any_transform_animation = | 235 const bool has_any_transform_animation = |
234 layer->HasAnyAnimationTargetingProperty(Animation::TRANSFORM); | 236 layer->HasAnyAnimationTargetingProperty(Animation::TRANSFORM); |
235 | 237 |
236 const bool has_surface = layer->has_render_surface(); | 238 const bool has_surface = created_render_surface; |
237 | 239 |
238 bool requires_node = is_root || is_scrollable || has_significant_transform || | 240 bool requires_node = is_root || is_scrollable || has_significant_transform || |
239 has_any_transform_animation || has_surface || is_fixed || | 241 has_any_transform_animation || has_surface || is_fixed || |
240 is_page_scale_layer || is_overscroll_elasticity_layer; | 242 is_page_scale_layer || is_overscroll_elasticity_layer; |
241 | 243 |
242 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); | 244 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); |
243 DCHECK(is_root || transform_parent); | 245 DCHECK(is_root || transform_parent); |
244 | 246 |
245 int parent_index = kRootPropertyTreeNodeId; | 247 int parent_index = kRootPropertyTreeNodeId; |
246 if (transform_parent) | 248 if (transform_parent) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 bool IsAnimatingOpacity(Layer* layer) { | 426 bool IsAnimatingOpacity(Layer* layer) { |
425 return layer->HasPotentiallyRunningOpacityAnimation() || | 427 return layer->HasPotentiallyRunningOpacityAnimation() || |
426 layer->OpacityCanAnimateOnImplThread(); | 428 layer->OpacityCanAnimateOnImplThread(); |
427 } | 429 } |
428 | 430 |
429 bool IsAnimatingOpacity(LayerImpl* layer) { | 431 bool IsAnimatingOpacity(LayerImpl* layer) { |
430 return layer->HasPotentiallyRunningOpacityAnimation(); | 432 return layer->HasPotentiallyRunningOpacityAnimation(); |
431 } | 433 } |
432 | 434 |
433 template <typename LayerType> | 435 template <typename LayerType> |
| 436 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) { |
| 437 return layer->Is3dSorted() && layer->parent() && |
| 438 layer->parent()->Is3dSorted() && |
| 439 (layer->parent()->sorting_context_id() == layer->sorting_context_id()); |
| 440 } |
| 441 |
| 442 template <typename LayerType> |
| 443 bool ShouldCreateRenderSurface(LayerType* layer, |
| 444 gfx::Transform current_transform, |
| 445 bool axis_aligned) { |
| 446 const bool preserves_2d_axis_alignment = |
| 447 (current_transform * layer->transform()).Preserves2dAxisAlignment() && |
| 448 axis_aligned && layer->AnimationsPreserveAxisAlignment(); |
| 449 const bool is_root = !layer->parent(); |
| 450 if (is_root) |
| 451 return true; |
| 452 |
| 453 // If the layer uses a mask and the layer is not a replica layer. |
| 454 // TODO(weiliangc): After slimming paint there won't be replica layers. |
| 455 if (layer->mask_layer() && layer->parent()->replica_layer() != layer) { |
| 456 return true; |
| 457 } |
| 458 |
| 459 // If the layer has a reflection. |
| 460 if (layer->replica_layer()) { |
| 461 return true; |
| 462 } |
| 463 |
| 464 // If the layer uses a CSS filter. |
| 465 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) { |
| 466 return true; |
| 467 } |
| 468 |
| 469 // If the layer will use a CSS filter. In this case, the animation |
| 470 // will start and add a filter to this layer, so it needs a surface. |
| 471 if (layer->HasPotentiallyRunningFilterAnimation()) { |
| 472 return true; |
| 473 } |
| 474 |
| 475 int num_descendants_that_draw_content = |
| 476 layer->NumDescendantsThatDrawContent(); |
| 477 |
| 478 // If the layer flattens its subtree, but it is treated as a 3D object by its |
| 479 // parent (i.e. parent participates in a 3D rendering context). |
| 480 if (LayerIsInExisting3DRenderingContext(layer) && |
| 481 layer->should_flatten_transform() && |
| 482 num_descendants_that_draw_content > 0) { |
| 483 TRACE_EVENT_INSTANT0( |
| 484 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface flattening", |
| 485 TRACE_EVENT_SCOPE_THREAD); |
| 486 return true; |
| 487 } |
| 488 |
| 489 // If the layer has blending. |
| 490 // TODO(rosca): this is temporary, until blending is implemented for other |
| 491 // types of quads than RenderPassDrawQuad. Layers having descendants that draw |
| 492 // content will still create a separate rendering surface. |
| 493 if (!layer->uses_default_blend_mode()) { |
| 494 TRACE_EVENT_INSTANT0( |
| 495 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface blending", |
| 496 TRACE_EVENT_SCOPE_THREAD); |
| 497 return true; |
| 498 } |
| 499 // If the layer clips its descendants but it is not axis-aligned with respect |
| 500 // to its parent. |
| 501 bool layer_clips_external_content = |
| 502 LayerClipsSubtree(layer) || layer->HasDelegatedContent(); |
| 503 if (layer_clips_external_content && !preserves_2d_axis_alignment && |
| 504 num_descendants_that_draw_content > 0) { |
| 505 TRACE_EVENT_INSTANT0( |
| 506 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface clipping", |
| 507 TRACE_EVENT_SCOPE_THREAD); |
| 508 return true; |
| 509 } |
| 510 |
| 511 // If the layer has some translucency and does not have a preserves-3d |
| 512 // transform style. This condition only needs a render surface if two or more |
| 513 // layers in the subtree overlap. But checking layer overlaps is unnecessarily |
| 514 // costly so instead we conservatively create a surface whenever at least two |
| 515 // layers draw content for this subtree. |
| 516 bool at_least_two_layers_in_subtree_draw_content = |
| 517 num_descendants_that_draw_content > 0 && |
| 518 (layer->DrawsContent() || num_descendants_that_draw_content > 1); |
| 519 |
| 520 if (layer->opacity() != 1.f && layer->should_flatten_transform() && |
| 521 at_least_two_layers_in_subtree_draw_content) { |
| 522 TRACE_EVENT_INSTANT0( |
| 523 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface opacity", |
| 524 TRACE_EVENT_SCOPE_THREAD); |
| 525 DCHECK(!is_root); |
| 526 return true; |
| 527 } |
| 528 // If the layer has isolation. |
| 529 // TODO(rosca): to be optimized - create separate rendering surface only when |
| 530 // the blending descendants might have access to the content behind this layer |
| 531 // (layer has transparent background or descendants overflow). |
| 532 // https://code.google.com/p/chromium/issues/detail?id=301738 |
| 533 if (layer->is_root_for_isolated_group()) { |
| 534 TRACE_EVENT_INSTANT0( |
| 535 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface isolation", |
| 536 TRACE_EVENT_SCOPE_THREAD); |
| 537 return true; |
| 538 } |
| 539 |
| 540 // If we force it. |
| 541 if (layer->force_render_surface()) |
| 542 return true; |
| 543 |
| 544 // If we'll make a copy of the layer's contents. |
| 545 if (layer->HasCopyRequest()) |
| 546 return true; |
| 547 |
| 548 return false; |
| 549 } |
| 550 |
| 551 template <typename LayerType> |
434 bool AddEffectNodeIfNeeded( | 552 bool AddEffectNodeIfNeeded( |
435 const DataForRecursion<LayerType>& data_from_ancestor, | 553 const DataForRecursion<LayerType>& data_from_ancestor, |
436 LayerType* layer, | 554 LayerType* layer, |
437 DataForRecursion<LayerType>* data_for_children) { | 555 DataForRecursion<LayerType>* data_for_children) { |
438 const bool is_root = !layer->parent(); | 556 const bool is_root = !layer->parent(); |
439 const bool has_transparency = layer->opacity() != 1.f; | 557 const bool has_transparency = layer->opacity() != 1.f; |
440 const bool has_animated_opacity = IsAnimatingOpacity(layer); | 558 const bool has_animated_opacity = IsAnimatingOpacity(layer); |
441 const bool has_render_surface = layer->has_render_surface(); | 559 const bool should_create_render_surface = ShouldCreateRenderSurface( |
442 bool requires_node = | 560 layer, data_from_ancestor.compound_transform_since_render_target, |
443 is_root || has_transparency || has_animated_opacity || has_render_surface; | 561 data_from_ancestor.axis_align_since_render_target); |
| 562 data_for_children->axis_align_since_render_target &= |
| 563 layer->AnimationsPreserveAxisAlignment(); |
| 564 |
| 565 bool requires_node = is_root || has_transparency || has_animated_opacity || |
| 566 should_create_render_surface; |
444 | 567 |
445 int parent_id = data_from_ancestor.effect_tree_parent; | 568 int parent_id = data_from_ancestor.effect_tree_parent; |
446 | 569 |
447 if (!requires_node) { | 570 if (!requires_node) { |
448 layer->SetEffectTreeIndex(parent_id); | 571 layer->SetEffectTreeIndex(parent_id); |
449 data_for_children->effect_tree_parent = parent_id; | 572 data_for_children->effect_tree_parent = parent_id; |
| 573 data_for_children->compound_transform_since_render_target *= |
| 574 layer->transform(); |
450 return false; | 575 return false; |
451 } | 576 } |
452 | 577 |
453 EffectNode node; | 578 EffectNode node; |
454 node.owner_id = layer->id(); | 579 node.owner_id = layer->id(); |
455 node.data.opacity = layer->opacity(); | 580 node.data.opacity = layer->opacity(); |
456 node.data.screen_space_opacity = layer->opacity(); | 581 node.data.screen_space_opacity = layer->opacity(); |
457 node.data.has_render_surface = has_render_surface; | 582 node.data.has_render_surface = should_create_render_surface; |
| 583 |
458 if (!is_root) { | 584 if (!is_root) { |
459 // For every effect node, we create a transform node, so it's safe to use | 585 // For every effect node, we create a transform node, so it's safe to use |
460 // the next available id from the transform tree as this effect node's | 586 // the next available id from the transform tree as this effect node's |
461 // transform id. | 587 // transform id. |
462 node.data.transform_id = | 588 node.data.transform_id = |
463 data_from_ancestor.transform_tree->next_available_id(); | 589 data_from_ancestor.transform_tree->next_available_id(); |
464 node.data.clip_id = data_from_ancestor.clip_tree_parent; | 590 node.data.clip_id = data_from_ancestor.clip_tree_parent; |
465 | 591 |
466 node.data.screen_space_opacity *= | 592 node.data.screen_space_opacity *= |
467 data_from_ancestor.effect_tree->Node(parent_id) | 593 data_from_ancestor.effect_tree->Node(parent_id) |
468 ->data.screen_space_opacity; | 594 ->data.screen_space_opacity; |
469 } else { | 595 } else { |
470 // Root render surface acts the unbounded and untransformed to draw content | 596 // Root render surface acts the unbounded and untransformed to draw content |
471 // into. Transform node created from root layer (includes device scale | 597 // into. Transform node created from root layer (includes device scale |
472 // factor) and clip node created from root layer (include viewports) applies | 598 // factor) and clip node created from root layer (include viewports) applies |
473 // to root render surface's content, but not root render surface itself. | 599 // to root render surface's content, but not root render surface itself. |
474 node.data.transform_id = kRootPropertyTreeNodeId; | 600 node.data.transform_id = kRootPropertyTreeNodeId; |
475 node.data.clip_id = kRootPropertyTreeNodeId; | 601 node.data.clip_id = kRootPropertyTreeNodeId; |
476 } | 602 } |
477 data_for_children->effect_tree_parent = | 603 data_for_children->effect_tree_parent = |
478 data_for_children->effect_tree->Insert(node, parent_id); | 604 data_for_children->effect_tree->Insert(node, parent_id); |
479 layer->SetEffectTreeIndex(data_for_children->effect_tree_parent); | 605 layer->SetEffectTreeIndex(data_for_children->effect_tree_parent); |
480 return has_render_surface; | 606 if (should_create_render_surface) { |
| 607 data_for_children->compound_transform_since_render_target = |
| 608 gfx::Transform(); |
| 609 data_for_children->axis_align_since_render_target = true; |
| 610 } |
| 611 return should_create_render_surface; |
481 } | 612 } |
482 | 613 |
483 template <typename LayerType> | 614 template <typename LayerType> |
484 void BuildPropertyTreesInternal( | 615 void BuildPropertyTreesInternal( |
485 LayerType* layer, | 616 LayerType* layer, |
486 const DataForRecursion<LayerType>& data_from_parent) { | 617 const DataForRecursion<LayerType>& data_from_parent) { |
487 layer->set_property_tree_sequence_number(data_from_parent.sequence_number); | 618 layer->set_property_tree_sequence_number(data_from_parent.sequence_number); |
488 DataForRecursion<LayerType> data_for_children(data_from_parent); | 619 DataForRecursion<LayerType> data_for_children(data_from_parent); |
489 | 620 |
490 bool created_render_surface = | 621 bool created_render_surface = |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 data_for_recursion.in_subtree_of_page_scale_layer = false; | 705 data_for_recursion.in_subtree_of_page_scale_layer = false; |
575 data_for_recursion.affected_by_inner_viewport_bounds_delta = false; | 706 data_for_recursion.affected_by_inner_viewport_bounds_delta = false; |
576 data_for_recursion.affected_by_outer_viewport_bounds_delta = false; | 707 data_for_recursion.affected_by_outer_viewport_bounds_delta = false; |
577 data_for_recursion.should_flatten = false; | 708 data_for_recursion.should_flatten = false; |
578 data_for_recursion.target_is_clipped = false; | 709 data_for_recursion.target_is_clipped = false; |
579 data_for_recursion.device_transform = &device_transform; | 710 data_for_recursion.device_transform = &device_transform; |
580 | 711 |
581 data_for_recursion.transform_tree->clear(); | 712 data_for_recursion.transform_tree->clear(); |
582 data_for_recursion.clip_tree->clear(); | 713 data_for_recursion.clip_tree->clear(); |
583 data_for_recursion.effect_tree->clear(); | 714 data_for_recursion.effect_tree->clear(); |
| 715 data_for_recursion.compound_transform_since_render_target = gfx::Transform(); |
| 716 data_for_recursion.axis_align_since_render_target = true; |
584 data_for_recursion.sequence_number = property_trees->sequence_number; | 717 data_for_recursion.sequence_number = property_trees->sequence_number; |
585 data_for_recursion.transform_tree->set_device_scale_factor( | 718 data_for_recursion.transform_tree->set_device_scale_factor( |
586 device_scale_factor); | 719 device_scale_factor); |
587 | 720 |
588 ClipNode root_clip; | 721 ClipNode root_clip; |
589 root_clip.data.resets_clip = true; | 722 root_clip.data.resets_clip = true; |
590 root_clip.data.applies_local_clip = true; | 723 root_clip.data.applies_local_clip = true; |
591 root_clip.data.clip = gfx::RectF(viewport); | 724 root_clip.data.clip = gfx::RectF(viewport); |
592 root_clip.data.transform_id = kRootPropertyTreeNodeId; | 725 root_clip.data.transform_id = kRootPropertyTreeNodeId; |
593 data_for_recursion.clip_tree_parent = | 726 data_for_recursion.clip_tree_parent = |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 const gfx::Transform& device_transform, | 768 const gfx::Transform& device_transform, |
636 PropertyTrees* property_trees) { | 769 PropertyTrees* property_trees) { |
637 BuildPropertyTreesTopLevelInternal( | 770 BuildPropertyTreesTopLevelInternal( |
638 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 771 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
639 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 772 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
640 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 773 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
641 device_transform, property_trees); | 774 device_transform, property_trees); |
642 } | 775 } |
643 | 776 |
644 } // namespace cc | 777 } // namespace cc |
OLD | NEW |