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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 // closer in this case, counterintuitively. | 1354 // closer in this case, counterintuitively. |
1355 float closest_distance; | 1355 float closest_distance; |
1356 }; | 1356 }; |
1357 | 1357 |
1358 template <typename Functor> | 1358 template <typename Functor> |
1359 static void FindClosestMatchingLayer( | 1359 static void FindClosestMatchingLayer( |
1360 const gfx::PointF& screen_space_point, | 1360 const gfx::PointF& screen_space_point, |
1361 LayerImpl* layer, | 1361 LayerImpl* layer, |
1362 const Functor& func, | 1362 const Functor& func, |
1363 FindClosestMatchingLayerDataForRecursion* data_for_recursion) { | 1363 FindClosestMatchingLayerDataForRecursion* data_for_recursion) { |
1364 for (int i = layer->children().size() - 1; i >= 0; --i) { | 1364 size_t children_size = layer->children().size(); |
1365 FindClosestMatchingLayer( | 1365 for (size_t i = 0; i < children_size; ++i) { |
1366 screen_space_point, layer->children()[i], func, data_for_recursion); | 1366 size_t index = children_size - 1 - i; |
| 1367 FindClosestMatchingLayer(screen_space_point, layer->children()[index], func, |
| 1368 data_for_recursion); |
1367 } | 1369 } |
1368 | 1370 |
1369 float distance_to_intersection = 0.f; | 1371 float distance_to_intersection = 0.f; |
1370 if (func(layer) && | 1372 if (func(layer) && |
1371 PointHitsLayer(layer, screen_space_point, &distance_to_intersection) && | 1373 PointHitsLayer(layer, screen_space_point, &distance_to_intersection) && |
1372 ((!data_for_recursion->closest_match || | 1374 ((!data_for_recursion->closest_match || |
1373 distance_to_intersection > data_for_recursion->closest_distance))) { | 1375 distance_to_intersection > data_for_recursion->closest_distance))) { |
1374 data_for_recursion->closest_distance = distance_to_intersection; | 1376 data_for_recursion->closest_distance = distance_to_intersection; |
1375 data_for_recursion->closest_match = layer; | 1377 data_for_recursion->closest_match = layer; |
1376 } | 1378 } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 scoped_ptr<PendingPageScaleAnimation> pending_animation) { | 1591 scoped_ptr<PendingPageScaleAnimation> pending_animation) { |
1590 pending_page_scale_animation_ = pending_animation.Pass(); | 1592 pending_page_scale_animation_ = pending_animation.Pass(); |
1591 } | 1593 } |
1592 | 1594 |
1593 scoped_ptr<PendingPageScaleAnimation> | 1595 scoped_ptr<PendingPageScaleAnimation> |
1594 LayerTreeImpl::TakePendingPageScaleAnimation() { | 1596 LayerTreeImpl::TakePendingPageScaleAnimation() { |
1595 return pending_page_scale_animation_.Pass(); | 1597 return pending_page_scale_animation_.Pass(); |
1596 } | 1598 } |
1597 | 1599 |
1598 } // namespace cc | 1600 } // namespace cc |
OLD | NEW |