Chromium Code Reviews| 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/heads_up_display_layer_impl.h" | |
|
danakj
2013/02/19 20:08:12
you don't need this header i don't think?
| |
| 10 #include "cc/layer.h" | 11 #include "cc/layer.h" |
| 11 #include "cc/layer_impl.h" | 12 #include "cc/layer_impl.h" |
| 12 #include "cc/layer_iterator.h" | 13 #include "cc/layer_iterator.h" |
| 13 #include "cc/layer_sorter.h" | 14 #include "cc/layer_sorter.h" |
| 15 #include "cc/layer_tree_impl.h" | |
| 14 #include "cc/math_util.h" | 16 #include "cc/math_util.h" |
| 15 #include "cc/render_surface.h" | 17 #include "cc/render_surface.h" |
| 16 #include "cc/render_surface_impl.h" | 18 #include "cc/render_surface_impl.h" |
| 17 #include "ui/gfx/point_conversions.h" | 19 #include "ui/gfx/point_conversions.h" |
| 18 #include "ui/gfx/rect_conversions.h" | 20 #include "ui/gfx/rect_conversions.h" |
| 19 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
| 20 | 22 |
| 21 namespace cc { | 23 namespace cc { |
| 22 | 24 |
| 23 ScrollAndScaleSet::ScrollAndScaleSet() | 25 ScrollAndScaleSet::ScrollAndScaleSet() |
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1126 currentLayer = currentLayer->parent(); | 1128 currentLayer = currentLayer->parent(); |
| 1127 } | 1129 } |
| 1128 | 1130 |
| 1129 // If we have finished walking all ancestors without having already exited, then the point is not clipped by any ancestors. | 1131 // If we have finished walking all ancestors without having already exited, then the point is not clipped by any ancestors. |
| 1130 return false; | 1132 return false; |
| 1131 } | 1133 } |
| 1132 | 1134 |
| 1133 LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const gfx::PointF& scr eenSpacePoint, const std::vector<LayerImpl*>& renderSurfaceLayerList) | 1135 LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const gfx::PointF& scr eenSpacePoint, const std::vector<LayerImpl*>& renderSurfaceLayerList) |
| 1134 { | 1136 { |
| 1135 LayerImpl* foundLayer = 0; | 1137 LayerImpl* foundLayer = 0; |
| 1138 LayerImpl* hudLayer = 0; | |
| 1139 if (renderSurfaceLayerList.empty()) | |
| 1140 return foundLayer; | |
| 1141 else | |
| 1142 hudLayer = renderSurfaceLayerList.front()->layerTreeImpl()->hud_layer(); | |
|
danakj
2013/02/19 20:08:12
If this code is going to move to LTImpl anyways, I
danakj
2013/02/19 22:52:58
Nix that. It will require a lot of test changes..
| |
| 1136 | 1143 |
| 1137 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; | 1144 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; |
| 1138 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); | 1145 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); |
| 1139 | 1146 |
| 1140 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList ); it != end; ++it) { | 1147 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList ); it != end; ++it) { |
| 1141 // We don't want to consider renderSurfaces for hit testing. | 1148 // We don't want to consider renderSurfaces for hit testing. |
| 1142 if (!it.representsItself()) | 1149 if (!it.representsItself()) |
| 1143 continue; | 1150 continue; |
| 1144 | 1151 |
| 1145 LayerImpl* currentLayer = (*it); | 1152 LayerImpl* currentLayer = (*it); |
| 1146 | 1153 |
| 1154 if (currentLayer == hudLayer) | |
|
danakj
2013/02/19 22:52:58
Since this is the least likely thing to exclude a
| |
| 1155 continue; | |
| 1156 | |
| 1147 gfx::RectF contentRect(gfx::PointF(), currentLayer->contentBounds()); | 1157 gfx::RectF contentRect(gfx::PointF(), currentLayer->contentBounds()); |
| 1148 if (!pointHitsRect(screenSpacePoint, currentLayer->screenSpaceTransform( ), contentRect)) | 1158 if (!pointHitsRect(screenSpacePoint, currentLayer->screenSpaceTransform( ), contentRect)) |
| 1149 continue; | 1159 continue; |
| 1150 | 1160 |
| 1151 // At this point, we think the point does hit the layer, but we need to walk up | 1161 // At this point, we think the point does hit the layer, but we need to walk up |
| 1152 // the parents to ensure that the layer was not clipped in such a way th at the | 1162 // the parents to ensure that the layer was not clipped in such a way th at the |
| 1153 // hit point actually should not hit the layer. | 1163 // hit point actually should not hit the layer. |
| 1154 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, currentLayer)) | 1164 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, currentLayer)) |
| 1155 continue; | 1165 continue; |
| 1156 | 1166 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1196 | 1206 |
| 1197 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up | 1207 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up |
| 1198 // the parents to ensure that the layer was not clipped in such a way that the | 1208 // the parents to ensure that the layer was not clipped in such a way that the |
| 1199 // hit point actually should not hit the layer. | 1209 // hit point actually should not hit the layer. |
| 1200 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) | 1210 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) |
| 1201 return false; | 1211 return false; |
| 1202 | 1212 |
| 1203 return true; | 1213 return true; |
| 1204 } | 1214 } |
| 1205 } // namespace cc | 1215 } // namespace cc |
| OLD | NEW |