Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 27718006: cc: Fix touch hit-testing for overlapping layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 6bc9d3a522c812f2711a1b194b39399e1edfe07a..ce4505354c939da47bb89885c87d30837f5af390 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -2344,34 +2344,21 @@ LayerImpl* LayerTreeHostCommon::FindLayerThatIsHitByPoint(
LayerImpl* LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
gfx::PointF screen_space_point,
const LayerImplList& render_surface_layer_list) {
- LayerImpl* found_layer = NULL;
-
- typedef LayerIterator<LayerImpl,
- LayerImplList,
- RenderSurfaceImpl,
- LayerIteratorActions::FrontToBack> LayerIteratorType;
- LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list);
-
- for (LayerIteratorType
- it = LayerIteratorType::Begin(&render_surface_layer_list);
- it != end;
- ++it) {
- // We don't want to consider render_surfaces for hit testing.
- if (!it.represents_itself())
- continue;
-
- LayerImpl* current_layer = (*it);
-
- if (!LayerHasTouchEventHandlersAt(screen_space_point, current_layer))
- continue;
-
- found_layer = current_layer;
- break;
+ // First find out which layer was hit from the saved list of visible layers
+ // in the most recent frame.
+ LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
+ screen_space_point,
+ render_surface_layer_list);
+
+ // Walk up the hierarchy and look for a layer with a touch event handler
+ // region that the given point hits.
+ // This walk may not be necessary anymore: http://crbug.com/310817
+ for (; layer_impl; layer_impl = layer_impl->parent()) {
+ if (LayerTreeHostCommon::LayerHasTouchEventHandlersAt(screen_space_point,
+ layer_impl))
+ break;
}
-
- // This can potentially return NULL, which means the screen_space_point did
- // not successfully hit test any layers, not even the root layer.
- return found_layer;
+ return layer_impl;
}
bool LayerTreeHostCommon::LayerHasTouchEventHandlersAt(
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698