| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 case 0: | 455 case 0: |
| 456 EXPECT_VECTOR_EQ( | 456 EXPECT_VECTOR_EQ( |
| 457 gfx::Vector2d(0, 0), | 457 gfx::Vector2d(0, 0), |
| 458 ScrollTreeForLayer(scroll_layer) | 458 ScrollTreeForLayer(scroll_layer) |
| 459 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); | 459 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); |
| 460 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), ScrollDelta(scroll_layer)); | 460 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), ScrollDelta(scroll_layer)); |
| 461 PostSetNeedsCommitToMainThread(); | 461 PostSetNeedsCommitToMainThread(); |
| 462 break; | 462 break; |
| 463 case 1: | 463 case 1: |
| 464 EXPECT_VECTOR_EQ( | 464 EXPECT_VECTOR_EQ( |
| 465 gfx::ToFlooredVector2d(scroll_amount_), | 465 gfx::ToRoundedVector2d(scroll_amount_), |
| 466 ScrollTreeForLayer(scroll_layer) | 466 ScrollTreeForLayer(scroll_layer) |
| 467 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); | 467 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); |
| 468 EXPECT_VECTOR_EQ(gfx::Vector2dF(fmod(scroll_amount_.x(), 1.0f), 0.0f), | 468 EXPECT_VECTOR_EQ( |
| 469 ScrollDelta(scroll_layer)); | 469 scroll_amount_ - gfx::ToRoundedVector2d(scroll_amount_), |
| 470 ScrollDelta(scroll_layer)); |
| 470 PostSetNeedsCommitToMainThread(); | 471 PostSetNeedsCommitToMainThread(); |
| 471 break; | 472 break; |
| 472 case 2: | 473 case 2: |
| 473 EXPECT_VECTOR_EQ( | 474 EXPECT_VECTOR_EQ( |
| 474 gfx::ToFlooredVector2d(scroll_amount_ + scroll_amount_), | 475 gfx::ToRoundedVector2d(scroll_amount_ + scroll_amount_), |
| 475 ScrollTreeForLayer(scroll_layer) | 476 ScrollTreeForLayer(scroll_layer) |
| 476 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); | 477 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); |
| 477 EXPECT_VECTOR_EQ( | 478 EXPECT_VECTOR_EQ( |
| 478 gfx::Vector2dF(fmod(2.0f * scroll_amount_.x(), 1.0f), 0.0f), | 479 scroll_amount_ + scroll_amount_ - |
| 480 gfx::ToRoundedVector2d(scroll_amount_ + scroll_amount_), |
| 479 ScrollDelta(scroll_layer)); | 481 ScrollDelta(scroll_layer)); |
| 480 EndTest(); | 482 EndTest(); |
| 481 break; | 483 break; |
| 482 } | 484 } |
| 483 scroll_layer->ScrollBy(scroll_amount_); | 485 scroll_layer->ScrollBy(scroll_amount_); |
| 484 } | 486 } |
| 485 | 487 |
| 486 void AfterTest() override {} | 488 void AfterTest() override {} |
| 487 | 489 |
| 488 private: | 490 private: |
| (...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 | 2232 |
| 2231 const float initial_page_scale_ = 0.5f; | 2233 const float initial_page_scale_ = 0.5f; |
| 2232 const float page_scale_update_ = 0.2f; | 2234 const float page_scale_update_ = 0.2f; |
| 2233 }; | 2235 }; |
| 2234 | 2236 |
| 2235 // The reflected deltas are supported in threaded mode only. | 2237 // The reflected deltas are supported in threaded mode only. |
| 2236 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestAppliesReflectedDeltas); | 2238 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestAppliesReflectedDeltas); |
| 2237 | 2239 |
| 2238 } // namespace | 2240 } // namespace |
| 2239 } // namespace cc | 2241 } // namespace cc |
| OLD | NEW |