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/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 case 0: | 456 case 0: |
457 EXPECT_VECTOR_EQ( | 457 EXPECT_VECTOR_EQ( |
458 gfx::Vector2d(0, 0), | 458 gfx::Vector2d(0, 0), |
459 ScrollTreeForLayer(scroll_layer) | 459 ScrollTreeForLayer(scroll_layer) |
460 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); | 460 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); |
461 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), ScrollDelta(scroll_layer)); | 461 EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), ScrollDelta(scroll_layer)); |
462 PostSetNeedsCommitToMainThread(); | 462 PostSetNeedsCommitToMainThread(); |
463 break; | 463 break; |
464 case 1: | 464 case 1: |
465 EXPECT_VECTOR_EQ( | 465 EXPECT_VECTOR_EQ( |
466 gfx::ToRoundedVector2d(scroll_amount_), | 466 gfx::ToFlooredVector2d(scroll_amount_), |
467 ScrollTreeForLayer(scroll_layer) | 467 ScrollTreeForLayer(scroll_layer) |
468 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); | 468 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); |
469 EXPECT_VECTOR_EQ( | 469 EXPECT_VECTOR_EQ(gfx::Vector2dF(fmod(scroll_amount_.x(), 1.0f), 0.0f), |
470 scroll_amount_ - gfx::ToRoundedVector2d(scroll_amount_), | 470 ScrollDelta(scroll_layer)); |
471 ScrollDelta(scroll_layer)); | |
472 PostSetNeedsCommitToMainThread(); | 471 PostSetNeedsCommitToMainThread(); |
473 break; | 472 break; |
474 case 2: | 473 case 2: |
475 EXPECT_VECTOR_EQ( | 474 EXPECT_VECTOR_EQ( |
476 gfx::ToRoundedVector2d(scroll_amount_ + scroll_amount_), | 475 gfx::ToFlooredVector2d(scroll_amount_ + scroll_amount_), |
477 ScrollTreeForLayer(scroll_layer) | 476 ScrollTreeForLayer(scroll_layer) |
478 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); | 477 ->GetScrollOffsetBaseForTesting(scroll_layer->id())); |
479 EXPECT_VECTOR_EQ( | 478 EXPECT_VECTOR_EQ( |
480 scroll_amount_ + scroll_amount_ - | 479 gfx::Vector2dF(fmod(2.0f * scroll_amount_.x(), 1.0f), 0.0f), |
481 gfx::ToRoundedVector2d(scroll_amount_ + scroll_amount_), | |
482 ScrollDelta(scroll_layer)); | 480 ScrollDelta(scroll_layer)); |
483 EndTest(); | 481 EndTest(); |
484 break; | 482 break; |
485 } | 483 } |
486 scroll_layer->ScrollBy(scroll_amount_); | 484 scroll_layer->ScrollBy(scroll_amount_); |
487 } | 485 } |
488 | 486 |
489 void AfterTest() override {} | 487 void AfterTest() override {} |
490 | 488 |
491 private: | 489 private: |
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 | 2238 |
2241 const float initial_page_scale_ = 0.5f; | 2239 const float initial_page_scale_ = 0.5f; |
2242 const float page_scale_update_ = 0.2f; | 2240 const float page_scale_update_ = 0.2f; |
2243 }; | 2241 }; |
2244 | 2242 |
2245 // The reflected deltas are supported in threaded mode only. | 2243 // The reflected deltas are supported in threaded mode only. |
2246 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestAppliesReflectedDeltas); | 2244 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestAppliesReflectedDeltas); |
2247 | 2245 |
2248 } // namespace | 2246 } // namespace |
2249 } // namespace cc | 2247 } // namespace cc |
OLD | NEW |