Chromium Code Reviews| Index: cc/trees/draw_property_utils.cc |
| diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc |
| index 0677b6088fba2ae22f7ebffee0db820f10ee9572..fdf8e08b32a493bf9e55617d2806b5781f4acf29 100644 |
| --- a/cc/trees/draw_property_utils.cc |
| +++ b/cc/trees/draw_property_utils.cc |
| @@ -605,6 +605,35 @@ static void SetSurfaceDrawTransform(const PropertyTrees* property_trees, |
| render_surface->SetDrawTransform(render_surface_transform); |
| } |
| +static bool LayerIsFullyVisible(LayerImpl* layer, |
| + const PropertyTrees* property_trees) { |
| + // If a layer is clipped, it is not fully visible |
| + if (layer->is_clipped()) |
| + return false; |
| + |
| + const EffectNode* effect_node = property_trees->effect_tree.Node( |
| + layer->render_target_effect_tree_index()); |
| + const EffectNode* target_effect_node = |
| + property_trees->effect_tree.Node(effect_node->target_id); |
| + |
| + // TODO(crbug.com/702010) : Remove this function's dependency on |
| + // effect node's has_unclipped_descendants. |
| + if (effect_node->clip_id == target_effect_node->clip_id) { |
| + // In this case, the layer is fully visible when the render surface it draws |
| + // into is not clipped. The render surface is clipped only if its target has |
| + // unclipped descendants and it doesn't. |
| + return target_effect_node->has_unclipped_descendants |
| + ? effect_node->has_unclipped_descendants |
| + : true; |
| + } |
| + |
| + // In this case, the render surface that the layer draws into is clipped |
| + // unless the render surface's clip node doesn't apply clip but expands it. |
| + const ClipNode* clip_node = |
| + property_trees->clip_tree.Node(effect_node->clip_id); |
| + return clip_node->clip_type == ClipNode::ClipType::EXPANDS_CLIP; |
| +} |
| + |
| static gfx::Rect LayerVisibleRect(PropertyTrees* property_trees, |
| LayerImpl* layer) { |
| int effect_ancestor_with_copy_request = |
| @@ -625,10 +654,7 @@ static gfx::Rect LayerVisibleRect(PropertyTrees* property_trees, |
| } else { |
| const ClipNode* clip_node = |
| property_trees->clip_tree.Node(layer->clip_tree_index()); |
| - const EffectNode* effect_node = property_trees->effect_tree.Node( |
| - layer->render_target_effect_tree_index()); |
| - bool fully_visible = |
| - !layer->is_clipped() && !effect_node->surface_is_clipped; |
| + bool fully_visible = LayerIsFullyVisible(layer, property_trees); |
| 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
|
| accumulated_clip_in_root_space = property_trees->clip_tree.ViewportClip(); |
| } else { |