Chromium Code Reviews| 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/draw_property_utils.h" | 5 #include "cc/trees/draw_property_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 598 gfx::Transform render_surface_transform; | 598 gfx::Transform render_surface_transform; |
| 599 const EffectNode* target_effect_node = | 599 const EffectNode* target_effect_node = |
| 600 effect_tree.Node(effect_node->target_id); | 600 effect_tree.Node(effect_node->target_id); |
| 601 property_trees->GetToTarget(transform_node->id, target_effect_node->id, | 601 property_trees->GetToTarget(transform_node->id, target_effect_node->id, |
| 602 &render_surface_transform); | 602 &render_surface_transform); |
| 603 | 603 |
| 604 ConcatInverseSurfaceContentsScale(effect_node, &render_surface_transform); | 604 ConcatInverseSurfaceContentsScale(effect_node, &render_surface_transform); |
| 605 render_surface->SetDrawTransform(render_surface_transform); | 605 render_surface->SetDrawTransform(render_surface_transform); |
| 606 } | 606 } |
| 607 | 607 |
| 608 static bool LayerIsFullyVisible(LayerImpl* layer, | |
| 609 const PropertyTrees* property_trees) { | |
| 610 // If a layer is clipped, it is not fully visible | |
| 611 if (layer->is_clipped()) | |
| 612 return false; | |
| 613 | |
| 614 const EffectNode* effect_node = property_trees->effect_tree.Node( | |
| 615 layer->render_target_effect_tree_index()); | |
| 616 const EffectNode* target_effect_node = | |
| 617 property_trees->effect_tree.Node(effect_node->target_id); | |
| 618 | |
| 619 // TODO(crbug.com/702010) : Remove this function's dependency on | |
| 620 // effect node's has_unclipped_descendants. | |
| 621 if (effect_node->clip_id == target_effect_node->clip_id) { | |
| 622 // In this case, the layer is fully visible when the render surface it draws | |
| 623 // into is not clipped. The render surface is clipped only if its target has | |
| 624 // unclipped descendants and it doesn't. | |
| 625 return target_effect_node->has_unclipped_descendants | |
| 626 ? effect_node->has_unclipped_descendants | |
| 627 : true; | |
| 628 } | |
| 629 | |
| 630 // In this case, the render surface that the layer draws into is clipped | |
| 631 // unless the render surface's clip node doesn't apply clip but expands it. | |
| 632 const ClipNode* clip_node = | |
| 633 property_trees->clip_tree.Node(effect_node->clip_id); | |
| 634 return clip_node->clip_type == ClipNode::ClipType::EXPANDS_CLIP; | |
| 635 } | |
| 636 | |
| 608 static gfx::Rect LayerVisibleRect(PropertyTrees* property_trees, | 637 static gfx::Rect LayerVisibleRect(PropertyTrees* property_trees, |
| 609 LayerImpl* layer) { | 638 LayerImpl* layer) { |
| 610 int effect_ancestor_with_copy_request = | 639 int effect_ancestor_with_copy_request = |
| 611 property_trees->effect_tree.ClosestAncestorWithCopyRequest( | 640 property_trees->effect_tree.ClosestAncestorWithCopyRequest( |
| 612 layer->effect_tree_index()); | 641 layer->effect_tree_index()); |
| 613 bool non_root_copy_request = | 642 bool non_root_copy_request = |
| 614 effect_ancestor_with_copy_request > EffectTree::kContentsRootNodeId; | 643 effect_ancestor_with_copy_request > EffectTree::kContentsRootNodeId; |
| 615 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds()); | 644 gfx::Rect layer_content_rect = gfx::Rect(layer->bounds()); |
| 616 gfx::RectF accumulated_clip_in_root_space; | 645 gfx::RectF accumulated_clip_in_root_space; |
| 617 if (non_root_copy_request) { | 646 if (non_root_copy_request) { |
| 618 bool include_expanding_clips = true; | 647 bool include_expanding_clips = true; |
| 619 ConditionalClip accumulated_clip = ComputeAccumulatedClip( | 648 ConditionalClip accumulated_clip = ComputeAccumulatedClip( |
| 620 property_trees, include_expanding_clips, layer->clip_tree_index(), | 649 property_trees, include_expanding_clips, layer->clip_tree_index(), |
| 621 effect_ancestor_with_copy_request); | 650 effect_ancestor_with_copy_request); |
| 622 if (!accumulated_clip.is_clipped) | 651 if (!accumulated_clip.is_clipped) |
| 623 return layer_content_rect; | 652 return layer_content_rect; |
| 624 accumulated_clip_in_root_space = accumulated_clip.clip_rect; | 653 accumulated_clip_in_root_space = accumulated_clip.clip_rect; |
| 625 } else { | 654 } else { |
| 626 const ClipNode* clip_node = | 655 const ClipNode* clip_node = |
| 627 property_trees->clip_tree.Node(layer->clip_tree_index()); | 656 property_trees->clip_tree.Node(layer->clip_tree_index()); |
| 628 const EffectNode* effect_node = property_trees->effect_tree.Node( | 657 bool fully_visible = LayerIsFullyVisible(layer, property_trees); |
| 629 layer->render_target_effect_tree_index()); | |
| 630 bool fully_visible = | |
| 631 !layer->is_clipped() && !effect_node->surface_is_clipped; | |
| 632 if (fully_visible) { | 658 if (fully_visible) { |
|
weiliangc
2017/03/24 18:52:25
Do we still need to check for fully_visible here?
jaydasika
2017/03/24 23:11:32
There was a layout test failure which made me thin
| |
| 633 accumulated_clip_in_root_space = property_trees->clip_tree.ViewportClip(); | 659 accumulated_clip_in_root_space = property_trees->clip_tree.ViewportClip(); |
| 634 } else { | 660 } else { |
| 635 accumulated_clip_in_root_space = | 661 accumulated_clip_in_root_space = |
| 636 clip_node->cached_accumulated_rect_in_screen_space; | 662 clip_node->cached_accumulated_rect_in_screen_space; |
| 637 } | 663 } |
| 638 } | 664 } |
| 639 | 665 |
| 640 const EffectNode* root_effect_node = | 666 const EffectNode* root_effect_node = |
| 641 non_root_copy_request | 667 non_root_copy_request |
| 642 ? property_trees->effect_tree.Node(effect_ancestor_with_copy_request) | 668 ? property_trees->effect_tree.Node(effect_ancestor_with_copy_request) |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1030 void UpdateElasticOverscroll(PropertyTrees* property_trees, | 1056 void UpdateElasticOverscroll(PropertyTrees* property_trees, |
| 1031 const Layer* overscroll_elasticity_layer, | 1057 const Layer* overscroll_elasticity_layer, |
| 1032 const gfx::Vector2dF& elastic_overscroll) { | 1058 const gfx::Vector2dF& elastic_overscroll) { |
| 1033 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, | 1059 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, |
| 1034 elastic_overscroll); | 1060 elastic_overscroll); |
| 1035 } | 1061 } |
| 1036 | 1062 |
| 1037 } // namespace draw_property_utils | 1063 } // namespace draw_property_utils |
| 1038 | 1064 |
| 1039 } // namespace cc | 1065 } // namespace cc |
| OLD | NEW |