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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host_common.h ('k') | cc/layer_tree_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/layer_tree_host_common.h" 5 #include "cc/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/layer.h" 10 #include "cc/layer.h"
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; 992 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
993 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); 993 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList);
994 994
995 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList ); it != end; ++it) { 995 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList ); it != end; ++it) {
996 // We don't want to consider renderSurfaces for hit testing. 996 // We don't want to consider renderSurfaces for hit testing.
997 if (!it.representsItself()) 997 if (!it.representsItself())
998 continue; 998 continue;
999 999
1000 LayerImpl* currentLayer = (*it); 1000 LayerImpl* currentLayer = (*it);
1001 1001
1002 if (currentLayer->touchEventHandlerRegion().IsEmpty()) 1002 if (!layerHasTouchEventHandlersAt(screenSpacePoint, currentLayer))
1003 continue;
1004
1005 if (!pointHitsRegion(screenSpacePoint, currentLayer->screenSpaceTransfor m(), currentLayer->touchEventHandlerRegion(), currentLayer->contentsScaleX(), cu rrentLayer->contentsScaleY()))
1006 continue;
1007
1008 // At this point, we think the point does hit the touch event handler re gion on the layer, but we need to walk up
1009 // the parents to ensure that the layer was not clipped in such a way th at the
1010 // hit point actually should not hit the layer.
1011 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, currentLayer))
1012 continue; 1003 continue;
1013 1004
1014 foundLayer = currentLayer; 1005 foundLayer = currentLayer;
1015 break; 1006 break;
1016 } 1007 }
1017 1008
1018 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer. 1009 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer.
1019 return foundLayer; 1010 return foundLayer;
1020 } 1011 }
1021 1012
1013 bool LayerTreeHostCommon::layerHasTouchEventHandlersAt(const gfx::PointF& screen SpacePoint, LayerImpl* layerImpl) {
1014 if (layerImpl->touchEventHandlerRegion().IsEmpty())
1015 return false;
1016
1017 if (!pointHitsRegion(screenSpacePoint, layerImpl->screenSpaceTransform(), laye rImpl->touchEventHandlerRegion(), layerImpl->contentsScaleX(), layerImpl->conten tsScaleY()))
1018 return false;;
1019
1020 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up
1021 // the parents to ensure that the layer was not clipped in such a way that the
1022 // hit point actually should not hit the layer.
1023 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl))
1024 return false;
1025
1026 return true;
1027 }
1022 } // namespace cc 1028 } // namespace cc
OLDNEW
« 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