| 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_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 | 223 |
| 224 static gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl) { | 224 static gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl) { |
| 225 gfx::ScrollOffset delta = | 225 gfx::ScrollOffset delta = |
| 226 layer_impl->layer_tree_impl() | 226 layer_impl->layer_tree_impl() |
| 227 ->property_trees() | 227 ->property_trees() |
| 228 ->scroll_tree.GetScrollOffsetDeltaForTesting(layer_impl->id()); | 228 ->scroll_tree.GetScrollOffsetDeltaForTesting(layer_impl->id()); |
| 229 return gfx::Vector2dF(delta.x(), delta.y()); | 229 return gfx::Vector2dF(delta.x(), delta.y()); |
| 230 } | 230 } |
| 231 | 231 |
| 232 static void ExpectClearedScrollDeltasRecursive(LayerImpl* layer) { | 232 static void ExpectClearedScrollDeltasRecursive(LayerImpl* root) { |
| 233 ASSERT_EQ(ScrollDelta(layer), gfx::Vector2d()); | 233 for (auto* layer : *root->layer_tree_impl()) |
| 234 for (size_t i = 0; i < layer->children().size(); ++i) | 234 ASSERT_EQ(ScrollDelta(layer), gfx::Vector2d()); |
| 235 ExpectClearedScrollDeltasRecursive(layer->children()[i]); | |
| 236 } | 235 } |
| 237 | 236 |
| 238 static ::testing::AssertionResult ScrollInfoContains( | 237 static ::testing::AssertionResult ScrollInfoContains( |
| 239 const ScrollAndScaleSet& scroll_info, | 238 const ScrollAndScaleSet& scroll_info, |
| 240 int id, | 239 int id, |
| 241 const gfx::Vector2d& scroll_delta) { | 240 const gfx::Vector2d& scroll_delta) { |
| 242 int times_encountered = 0; | 241 int times_encountered = 0; |
| 243 | 242 |
| 244 for (size_t i = 0; i < scroll_info.scrolls.size(); ++i) { | 243 for (size_t i = 0; i < scroll_info.scrolls.size(); ++i) { |
| 245 if (scroll_info.scrolls[i].layer_id != id) | 244 if (scroll_info.scrolls[i].layer_id != id) |
| (...skipping 10423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10669 // There should not be any jitter measured till we hit the fixed point hits | 10668 // There should not be any jitter measured till we hit the fixed point hits |
| 10670 // threshold. | 10669 // threshold. |
| 10671 float expected_jitter = | 10670 float expected_jitter = |
| 10672 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; | 10671 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; |
| 10673 EXPECT_EQ(jitter, expected_jitter); | 10672 EXPECT_EQ(jitter, expected_jitter); |
| 10674 } | 10673 } |
| 10675 } | 10674 } |
| 10676 | 10675 |
| 10677 } // namespace | 10676 } // namespace |
| 10678 } // namespace cc | 10677 } // namespace cc |
| OLD | NEW |