Chromium Code Reviews| Index: cc/trees/layer_tree_impl.cc |
| diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc |
| index 9932a33be03d59d47c6ea65ad437c8a46b4e76a6..101b757263fffae277450c1e5674e39914feb14d 100644 |
| --- a/cc/trees/layer_tree_impl.cc |
| +++ b/cc/trees/layer_tree_impl.cc |
| @@ -1095,35 +1095,45 @@ static bool PointHitsRegion(const gfx::PointF& screen_space_point, |
| gfx::ToRoundedPoint(hit_test_point_in_layer_space)); |
| } |
| +static LayerImpl* GetNextClippingLayer(LayerImpl* layer) { |
| + if (layer->scroll_parent()) |
| + return layer->scroll_parent(); |
| + if (layer->clip_parent()) |
| + return layer->clip_parent(); |
| + return layer->parent(); |
| +} |
| + |
| static bool PointIsClippedBySurfaceOrClipRect( |
| const gfx::PointF& screen_space_point, |
| LayerImpl* layer) { |
| - LayerImpl* current_layer = layer; |
| + LayerImpl* render_target = NULL; |
| + bool last_layer_had_surface = false; |
| // Walk up the layer tree and hit-test any render_surfaces and any layer |
| // clip rects that are active. |
| - while (current_layer) { |
| - if (current_layer->render_surface() && |
| - !PointHitsRect( |
| - screen_space_point, |
| - current_layer->render_surface()->screen_space_transform(), |
| - current_layer->render_surface()->content_rect(), |
| - NULL)) |
| + for (; layer; layer = GetNextClippingLayer(layer)) { |
| + if (last_layer_had_surface || layer->IsDrawnRenderSurfaceLayerListMember()) |
| + render_target = layer->render_target(); |
| + |
| + if (layer->render_surface() && |
| + !PointHitsRect(screen_space_point, |
| + layer->render_surface()->screen_space_transform(), |
| + layer->render_surface()->content_rect(), |
| + NULL)) |
| return true; |
| - // Note that drawable content rects are actually in target surface space, so |
| - // the transform we have to provide is the target surface's |
| + // Note that drawable content rects are actually in target surface space, |
| + // so the transform we have to provide is the target surface's |
| // screen_space_transform. |
| - LayerImpl* render_target = current_layer->render_target(); |
| - if (LayerClipsSubtree(current_layer) && |
| + if (render_target && LayerClipsSubtree(layer) && |
| !PointHitsRect( |
| screen_space_point, |
| render_target->render_surface()->screen_space_transform(), |
| - current_layer->drawable_content_rect(), |
| + gfx::Rect(layer->drawable_content_rect()), |
|
danakj
2014/06/11 17:43:06
no gfx::Rect needed
is there some guarantee that
|
| NULL)) |
| return true; |
| - current_layer = current_layer->parent(); |
| + last_layer_had_surface = !!layer->render_surface(); |
| } |
| // If we have finished walking all ancestors without having already exited, |