Index: cc/layer_tree_host_common.cc |
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc |
index 4af5717b71987c790e4fba3a16999fbd1841d134..a016a14235c575282128c3f0ec39f3afecbc7fa4 100644 |
--- a/cc/layer_tree_host_common.cc |
+++ b/cc/layer_tree_host_common.cc |
@@ -999,16 +999,7 @@ LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPointInTouchHandlerRegion(co |
LayerImpl* currentLayer = (*it); |
- if (currentLayer->touchEventHandlerRegion().IsEmpty()) |
- continue; |
- |
- if (!pointHitsRegion(screenSpacePoint, currentLayer->screenSpaceTransform(), currentLayer->touchEventHandlerRegion(), currentLayer->contentsScaleX(), currentLayer->contentsScaleY())) |
- continue; |
- |
- // At this point, we think the point does hit the touch event handler region on the layer, but we need to walk up |
- // the parents to ensure that the layer was not clipped in such a way that the |
- // hit point actually should not hit the layer. |
- if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, currentLayer)) |
+ if (!layerHasTouchEventHandlersAt(screenSpacePoint, currentLayer)) |
continue; |
foundLayer = currentLayer; |
@@ -1019,4 +1010,19 @@ LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPointInTouchHandlerRegion(co |
return foundLayer; |
} |
+bool LayerTreeHostCommon::layerHasTouchEventHandlersAt(const gfx::PointF& screenSpacePoint, LayerImpl* layerImpl) { |
+ if (layerImpl->touchEventHandlerRegion().IsEmpty()) |
+ return false; |
+ |
+ if (!pointHitsRegion(screenSpacePoint, layerImpl->screenSpaceTransform(), layerImpl->touchEventHandlerRegion(), layerImpl->contentsScaleX(), layerImpl->contentsScaleY())) |
+ return false;; |
+ |
+ // At this point, we think the point does hit the touch event handler region on the layer, but we need to walk up |
+ // the parents to ensure that the layer was not clipped in such a way that the |
+ // hit point actually should not hit the layer. |
+ if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) |
+ return false; |
+ |
+ return true; |
+} |
} // namespace cc |