OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2332 // If we have finished walking all ancestors without having already exited, | 2332 // If we have finished walking all ancestors without having already exited, |
2333 // then the point is not clipped by any ancestors. | 2333 // then the point is not clipped by any ancestors. |
2334 return false; | 2334 return false; |
2335 } | 2335 } |
2336 | 2336 |
2337 LayerImpl* LayerTreeHostCommon::FindLayerThatIsHitByPoint( | 2337 LayerImpl* LayerTreeHostCommon::FindLayerThatIsHitByPoint( |
2338 const gfx::PointF& screen_space_point, | 2338 const gfx::PointF& screen_space_point, |
2339 const LayerImplList& render_surface_layer_list) { | 2339 const LayerImplList& render_surface_layer_list) { |
2340 LayerImpl* found_layer = NULL; | 2340 LayerImpl* found_layer = NULL; |
2341 | 2341 |
2342 typedef LayerIterator<LayerImpl, | 2342 typedef LayerIterator<LayerImpl> LayerIteratorType; |
2343 LayerImplList, | |
2344 RenderSurfaceImpl, | |
2345 LayerIteratorActions::FrontToBack> LayerIteratorType; | |
2346 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list); | 2343 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list); |
2347 | |
2348 for (LayerIteratorType | 2344 for (LayerIteratorType |
2349 it = LayerIteratorType::Begin(&render_surface_layer_list); | 2345 it = LayerIteratorType::Begin(&render_surface_layer_list); |
2350 it != end; | 2346 it != end; |
2351 ++it) { | 2347 ++it) { |
2352 // We don't want to consider render_surfaces for hit testing. | 2348 // We don't want to consider render_surfaces for hit testing. |
2353 if (!it.represents_itself()) | 2349 if (!it.represents_itself()) |
2354 continue; | 2350 continue; |
2355 | 2351 |
2356 LayerImpl* current_layer = (*it); | 2352 LayerImpl* current_layer = (*it); |
2357 | 2353 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2416 // At this point, we think the point does hit the touch event handler region | 2412 // At this point, we think the point does hit the touch event handler region |
2417 // on the layer, but we need to walk up the parents to ensure that the layer | 2413 // on the layer, but we need to walk up the parents to ensure that the layer |
2418 // was not clipped in such a way that the hit point actually should not hit | 2414 // was not clipped in such a way that the hit point actually should not hit |
2419 // the layer. | 2415 // the layer. |
2420 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) | 2416 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) |
2421 return false; | 2417 return false; |
2422 | 2418 |
2423 return true; | 2419 return true; |
2424 } | 2420 } |
2425 } // namespace cc | 2421 } // namespace cc |
OLD | NEW |