OLD | NEW |
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 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 if (layerClipsSubtree(currentLayer) && !pointHitsRect(screenSpacePoint,
renderTarget->renderSurface()->screenSpaceTransform(), currentLayer->drawableCon
tentRect())) | 1045 if (layerClipsSubtree(currentLayer) && !pointHitsRect(screenSpacePoint,
renderTarget->renderSurface()->screenSpaceTransform(), currentLayer->drawableCon
tentRect())) |
1046 return true; | 1046 return true; |
1047 | 1047 |
1048 currentLayer = currentLayer->parent(); | 1048 currentLayer = currentLayer->parent(); |
1049 } | 1049 } |
1050 | 1050 |
1051 // If we have finished walking all ancestors without having already exited,
then the point is not clipped by any ancestors. | 1051 // If we have finished walking all ancestors without having already exited,
then the point is not clipped by any ancestors. |
1052 return false; | 1052 return false; |
1053 } | 1053 } |
1054 | 1054 |
1055 LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const gfx::PointF& scr
eenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList) | 1055 LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const gfx::PointF& scr
eenSpacePoint, const std::vector<LayerImpl*>& renderSurfaceLayerList) |
1056 { | 1056 { |
1057 LayerImpl* foundLayer = 0; | 1057 LayerImpl* foundLayer = 0; |
1058 | 1058 |
1059 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl,
LayerIteratorActions::FrontToBack> LayerIteratorType; | 1059 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl,
LayerIteratorActions::FrontToBack> LayerIteratorType; |
1060 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); | 1060 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); |
1061 | 1061 |
1062 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList
); it != end; ++it) { | 1062 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList
); it != end; ++it) { |
1063 // We don't want to consider renderSurfaces for hit testing. | 1063 // We don't want to consider renderSurfaces for hit testing. |
1064 if (!it.representsItself()) | 1064 if (!it.representsItself()) |
1065 continue; | 1065 continue; |
(...skipping 11 matching lines...) Expand all Loading... |
1077 continue; | 1077 continue; |
1078 | 1078 |
1079 foundLayer = currentLayer; | 1079 foundLayer = currentLayer; |
1080 break; | 1080 break; |
1081 } | 1081 } |
1082 | 1082 |
1083 // This can potentially return 0, which means the screenSpacePoint did not s
uccessfully hit test any layers, not even the root layer. | 1083 // This can potentially return 0, which means the screenSpacePoint did not s
uccessfully hit test any layers, not even the root layer. |
1084 return foundLayer; | 1084 return foundLayer; |
1085 } | 1085 } |
1086 | 1086 |
1087 LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPointInTouchHandlerRegion(co
nst gfx::PointF& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerLi
st) | 1087 LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPointInTouchHandlerRegion(co
nst gfx::PointF& screenSpacePoint, const std::vector<LayerImpl*>& renderSurfaceL
ayerList) |
1088 { | 1088 { |
1089 LayerImpl* foundLayer = 0; | 1089 LayerImpl* foundLayer = 0; |
1090 | 1090 |
1091 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl,
LayerIteratorActions::FrontToBack> LayerIteratorType; | 1091 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl,
LayerIteratorActions::FrontToBack> LayerIteratorType; |
1092 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); | 1092 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); |
1093 | 1093 |
1094 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList
); it != end; ++it) { | 1094 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList
); it != end; ++it) { |
1095 // We don't want to consider renderSurfaces for hit testing. | 1095 // We don't want to consider renderSurfaces for hit testing. |
1096 if (!it.representsItself()) | 1096 if (!it.representsItself()) |
1097 continue; | 1097 continue; |
(...skipping 20 matching lines...) Expand all Loading... |
1118 | 1118 |
1119 // At this point, we think the point does hit the touch event handler region o
n the layer, but we need to walk up | 1119 // At this point, we think the point does hit the touch event handler region o
n the layer, but we need to walk up |
1120 // the parents to ensure that the layer was not clipped in such a way that the | 1120 // the parents to ensure that the layer was not clipped in such a way that the |
1121 // hit point actually should not hit the layer. | 1121 // hit point actually should not hit the layer. |
1122 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) | 1122 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) |
1123 return false; | 1123 return false; |
1124 | 1124 |
1125 return true; | 1125 return true; |
1126 } | 1126 } |
1127 } // namespace cc | 1127 } // namespace cc |
OLD | NEW |