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

Unified Diff: cc/layer_tree_host_common.cc

Issue 11534024: Check whether a touch point hits touch event handler regions in root layer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed extra qualification Created 8 years 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 | « cc/layer_tree_host_common.h ('k') | cc/layer_tree_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « cc/layer_tree_host_common.h ('k') | cc/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698