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

Unified Diff: cc/layer_tree_host_impl.cc

Issue 12280014: cc: Don't consider HUD layer for touches (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moved funcs around Created 7 years, 10 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 | « cc/layer_tree_host_impl.h ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index e09233ddb8feeaf1323ba89df05d7f82971579fe..f546596c894770a73f39036406592fcf3c98e358 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -325,7 +325,7 @@ bool LayerTreeHostImpl::haveTouchEventHandlersAt(const gfx::Point& viewportPoint
// First find out which layer was hit from the saved list of visible layers
// in the most recent frame.
- LayerImpl* layerImpl = LayerTreeHostCommon::findLayerThatIsHitByPoint(deviceViewportPoint, activeTree()->RenderSurfaceLayerList());
+ LayerImpl* layerImpl = findLayerThatIsHitByPoint(deviceViewportPoint, activeTree()->RenderSurfaceLayerList());
// Walk up the hierarchy and look for a layer with a touch event handler region that the given point hits.
for (; layerImpl; layerImpl = layerImpl->parent()) {
@@ -1189,7 +1189,7 @@ InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(gfx::Point viewp
// First find out which layer was hit from the saved list of visible layers
// in the most recent frame.
- LayerImpl* layerImpl = LayerTreeHostCommon::findLayerThatIsHitByPoint(deviceViewportPoint, activeTree()->RenderSurfaceLayerList());
+ LayerImpl* layerImpl = findLayerThatIsHitByPoint(deviceViewportPoint, activeTree()->RenderSurfaceLayerList());
// Walk up the hierarchy and look for a scrollable layer.
LayerImpl* potentiallyScrollingLayerImpl = 0;
@@ -1230,6 +1230,42 @@ InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(gfx::Point viewp
return ScrollIgnored;
}
+LayerImpl* LayerTreeHostImpl::findLayerThatIsHitByPoint(const gfx::PointF& screenSpacePoint, const std::vector<LayerImpl*>& renderSurfaceLayerList)
+{
+ LayerImpl* foundLayer = 0;
+
+ typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
+ LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList);
+ for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) {
+ // We don't want to consider renderSurfaces for hit testing.
+ if (!it.representsItself())
+ continue;
+
+ LayerImpl* currentLayer = (*it);
+
+ // Don't consider the hud layer as a viable target for hits.
+ if (currentLayer == activeTree()->hud_layer())
danakj 2013/02/18 19:18:49 I don't understand why we would need to move aroun
+ continue;
+
+ gfx::RectF contentRect(gfx::PointF(), currentLayer->contentBounds());
+ if (!MathUtil::pointHitsRect(screenSpacePoint, currentLayer->screenSpaceTransform(), contentRect))
+ continue;
+
+ // At this point, we think the point does hit 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 (LayerTreeHostCommon::pointIsClippedBySurfaceOrClipRect(screenSpacePoint, currentLayer))
+ continue;
+
+ foundLayer = currentLayer;
+ break;
+ }
+
+ // This can potentially return 0, which means the screenSpacePoint did not successfully hit test any layers, not even the root layer.
+ return foundLayer;
+}
+
+
gfx::Vector2dF LayerTreeHostImpl::scrollLayerWithViewportSpaceDelta(LayerImpl* layerImpl, float scaleFromViewportToScreenSpace, gfx::PointF viewportPoint, gfx::Vector2dF viewportDelta)
{
// Layers with non-invertible screen space transforms should not have passed the scroll hit
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698