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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
6 | 6 |
7 #include "cc/content_layer.h" | 7 #include "cc/content_layer.h" |
8 #include "cc/layer.h" | 8 #include "cc/layer.h" |
9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
10 #include "cc/layer_tree_impl.h" | 10 #include "cc/layer_tree_impl.h" |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 switch (impl->activeTree()->source_frame_number()) { | 372 switch (impl->activeTree()->source_frame_number()) { |
373 case 0: { | 373 case 0: { |
374 // Gesture scroll on impl thread. | 374 // Gesture scroll on impl thread. |
375 InputHandlerClient::ScrollStatus status = impl->scrollBegin( | 375 InputHandlerClient::ScrollStatus status = impl->scrollBegin( |
376 gfx::ToCeiledPoint( | 376 gfx::ToCeiledPoint( |
377 expected_scroll_layer_impl->position() + | 377 expected_scroll_layer_impl->position() + |
378 gfx::Vector2dF(0.5f, 0.5f)), | 378 gfx::Vector2dF(0.5f, 0.5f)), |
379 InputHandlerClient::Gesture); | 379 InputHandlerClient::Gesture); |
380 EXPECT_EQ(InputHandlerClient::ScrollStarted, status); | 380 EXPECT_EQ(InputHandlerClient::ScrollStarted, status); |
381 impl->scrollBy(gfx::Point(), scroll_amount_); | 381 impl->scrollBy(0, gfx::Point(), scroll_amount_); |
382 impl->scrollEnd(); | 382 impl->scrollEnd(); |
383 | 383 |
384 // Check the scroll is applied as a delta. | 384 // Check the scroll is applied as a delta. |
385 EXPECT_VECTOR_EQ( | 385 EXPECT_VECTOR_EQ( |
386 initial_offset_, | 386 initial_offset_, |
387 expected_scroll_layer_impl->scrollOffset()); | 387 expected_scroll_layer_impl->scrollOffset()); |
388 EXPECT_VECTOR_EQ( | 388 EXPECT_VECTOR_EQ( |
389 scroll_amount_, | 389 scroll_amount_, |
390 expected_scroll_layer_impl->scrollDelta()); | 390 expected_scroll_layer_impl->scrollDelta()); |
391 break; | 391 break; |
392 } | 392 } |
393 case 1: { | 393 case 1: { |
394 // Wheel scroll on impl thread. | 394 // Wheel scroll on impl thread. |
395 InputHandlerClient::ScrollStatus status = impl->scrollBegin( | 395 InputHandlerClient::ScrollStatus status = impl->scrollBegin( |
396 gfx::ToCeiledPoint( | 396 gfx::ToCeiledPoint( |
397 expected_scroll_layer_impl->position() + | 397 expected_scroll_layer_impl->position() + |
398 gfx::Vector2dF(0.5f, 0.5f)), | 398 gfx::Vector2dF(0.5f, 0.5f)), |
399 InputHandlerClient::Wheel); | 399 InputHandlerClient::Wheel); |
400 EXPECT_EQ(InputHandlerClient::ScrollStarted, status); | 400 EXPECT_EQ(InputHandlerClient::ScrollStarted, status); |
401 impl->scrollBy(gfx::Point(), scroll_amount_); | 401 impl->scrollBy(0, gfx::Point(), scroll_amount_); |
402 impl->scrollEnd(); | 402 impl->scrollEnd(); |
403 | 403 |
404 // Check the scroll is applied as a delta. | 404 // Check the scroll is applied as a delta. |
405 EXPECT_VECTOR_EQ( | 405 EXPECT_VECTOR_EQ( |
406 javascript_scroll_, | 406 javascript_scroll_, |
407 expected_scroll_layer_impl->scrollOffset()); | 407 expected_scroll_layer_impl->scrollOffset()); |
408 EXPECT_VECTOR_EQ( | 408 EXPECT_VECTOR_EQ( |
409 scroll_amount_, | 409 scroll_amount_, |
410 expected_scroll_layer_impl->scrollDelta()); | 410 expected_scroll_layer_impl->scrollDelta()); |
411 break; | 411 break; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 ScrollRootScrollLayer, false) | 467 ScrollRootScrollLayer, false) |
468 MULTI_THREAD_TEST_P2(LayerTreeHostScrollTestCaseWithChild, | 468 MULTI_THREAD_TEST_P2(LayerTreeHostScrollTestCaseWithChild, |
469 DeviceScaleFactor15, 1.5f, | 469 DeviceScaleFactor15, 1.5f, |
470 ScrollRootScrollLayer, false) | 470 ScrollRootScrollLayer, false) |
471 MULTI_THREAD_TEST_P2(LayerTreeHostScrollTestCaseWithChild, | 471 MULTI_THREAD_TEST_P2(LayerTreeHostScrollTestCaseWithChild, |
472 DeviceScaleFactor2, 2.0f, | 472 DeviceScaleFactor2, 2.0f, |
473 ScrollRootScrollLayer, false) | 473 ScrollRootScrollLayer, false) |
474 | 474 |
475 } // namespace | 475 } // namespace |
476 } // namespace cc | 476 } // namespace cc |
OLD | NEW |