Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2360963003: Revert "Touchpad scroll latching enabled for Mac behind flag." (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 688 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
689 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 689 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
690 status.main_thread_scrolling_reasons); 690 status.main_thread_scrolling_reasons);
691 691
692 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), 692 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
693 InputHandler::WHEEL)); 693 InputHandler::WHEEL));
694 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); 694 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
695 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10), 695 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10),
696 InputHandler::WHEEL)); 696 InputHandler::WHEEL));
697 host_impl_->ScrollEnd(EndState().get()); 697 host_impl_->ScrollEnd(EndState().get());
698 host_impl_->ClearCurrentlyScrollingLayerForTesting();
699 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), 698 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
700 InputHandler::WHEEL)); 699 InputHandler::WHEEL));
701 EXPECT_TRUE(did_request_redraw_); 700 EXPECT_TRUE(did_request_redraw_);
702 EXPECT_TRUE(did_request_commit_); 701 EXPECT_TRUE(did_request_commit_);
703 } 702 }
704 703
705 TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) { 704 TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) {
706 SetupScrollAndContentsLayers(gfx::Size(100, 100)); 705 SetupScrollAndContentsLayers(gfx::Size(100, 100));
707 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 706 host_impl_->active_tree()->BuildPropertyTreesForTesting();
708 707
709 host_impl_->SetViewportSize(gfx::Size(50, 50)); 708 host_impl_->SetViewportSize(gfx::Size(50, 50));
710 DrawFrame(); 709 DrawFrame();
711 710
712 InputHandler::ScrollStatus status = host_impl_->ScrollBegin( 711 InputHandler::ScrollStatus status = host_impl_->ScrollBegin(
713 BeginState(gfx::Point()).get(), InputHandler::WHEEL); 712 BeginState(gfx::Point()).get(), InputHandler::WHEEL);
714 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 713 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
715 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 714 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
716 status.main_thread_scrolling_reasons); 715 status.main_thread_scrolling_reasons);
717 716
718 EXPECT_FALSE(host_impl_->IsActivelyScrolling()); 717 EXPECT_FALSE(host_impl_->IsActivelyScrolling());
719 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); 718 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
720 EXPECT_TRUE(host_impl_->IsActivelyScrolling()); 719 EXPECT_TRUE(host_impl_->IsActivelyScrolling());
721 host_impl_->ScrollEnd(EndState().get()); 720 host_impl_->ScrollEnd(EndState().get());
722 host_impl_->ClearCurrentlyScrollingLayerForTesting();
723 EXPECT_FALSE(host_impl_->IsActivelyScrolling()); 721 EXPECT_FALSE(host_impl_->IsActivelyScrolling());
724 } 722 }
725 723
726 TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) { 724 TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) {
727 // We should not crash when trying to scroll an empty layer tree. 725 // We should not crash when trying to scroll an empty layer tree.
728 InputHandler::ScrollStatus status = host_impl_->ScrollBegin( 726 InputHandler::ScrollStatus status = host_impl_->ScrollBegin(
729 BeginState(gfx::Point()).get(), InputHandler::WHEEL); 727 BeginState(gfx::Point()).get(), InputHandler::WHEEL);
730 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); 728 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
731 EXPECT_EQ(MainThreadScrollingReason::kNoScrollingLayer, 729 EXPECT_EQ(MainThreadScrollingReason::kNoScrollingLayer,
732 status.main_thread_scrolling_reasons); 730 status.main_thread_scrolling_reasons);
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 1037 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
1040 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 1038 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
1041 status.main_thread_scrolling_reasons); 1039 status.main_thread_scrolling_reasons);
1042 1040
1043 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt( 1041 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(
1044 gfx::Point(75, 75), InputHandler::TOUCHSCREEN)); 1042 gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
1045 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); 1043 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
1046 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt( 1044 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
1047 gfx::Point(25, 25), InputHandler::TOUCHSCREEN)); 1045 gfx::Point(25, 25), InputHandler::TOUCHSCREEN));
1048 host_impl_->ScrollEnd(EndState().get()); 1046 host_impl_->ScrollEnd(EndState().get());
1049 host_impl_->ClearCurrentlyScrollingLayerForTesting();
1050 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt( 1047 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
1051 gfx::Point(75, 75), InputHandler::TOUCHSCREEN)); 1048 gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
1052 1049
1053 status = host_impl_->ScrollBegin(BeginState(gfx::Point(75, 75)).get(), 1050 status = host_impl_->ScrollBegin(BeginState(gfx::Point(75, 75)).get(),
1054 InputHandler::TOUCHSCREEN); 1051 InputHandler::TOUCHSCREEN);
1055 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 1052 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
1056 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 1053 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
1057 status.main_thread_scrolling_reasons); 1054 status.main_thread_scrolling_reasons);
1058 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt( 1055 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(
1059 gfx::Point(75, 75), InputHandler::TOUCHSCREEN)); 1056 gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
1060 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); 1057 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
1061 host_impl_->ScrollEnd(EndState().get()); 1058 host_impl_->ScrollEnd(EndState().get());
1062 host_impl_->ClearCurrentlyScrollingLayerForTesting();
1063 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt( 1059 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
1064 gfx::Point(75, 75), InputHandler::TOUCHSCREEN)); 1060 gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
1065 } 1061 }
1066 1062
1067 TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionWithOffset) { 1063 TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionWithOffset) {
1068 SetupScrollAndContentsLayers(gfx::Size(200, 200)); 1064 SetupScrollAndContentsLayers(gfx::Size(200, 200));
1069 host_impl_->SetViewportSize(gfx::Size(100, 100)); 1065 host_impl_->SetViewportSize(gfx::Size(100, 100));
1070 1066
1071 LayerImpl* root = *host_impl_->active_tree()->begin(); 1067 LayerImpl* root = *host_impl_->active_tree()->begin();
1072 root->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); 1068 root->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 SetupScrollAndContentsLayers(gfx::Size(200, 200)); 1111 SetupScrollAndContentsLayers(gfx::Size(200, 200));
1116 host_impl_->active_tree()->set_have_scroll_event_handlers(true); 1112 host_impl_->active_tree()->set_have_scroll_event_handlers(true);
1117 host_impl_->SetViewportSize(gfx::Size(50, 50)); 1113 host_impl_->SetViewportSize(gfx::Size(50, 50));
1118 DrawFrame(); 1114 DrawFrame();
1119 1115
1120 EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler()); 1116 EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
1121 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 1117 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
1122 InputHandler::TOUCHSCREEN); 1118 InputHandler::TOUCHSCREEN);
1123 EXPECT_TRUE(host_impl_->scroll_affects_scroll_handler()); 1119 EXPECT_TRUE(host_impl_->scroll_affects_scroll_handler());
1124 host_impl_->ScrollEnd(EndState().get()); 1120 host_impl_->ScrollEnd(EndState().get());
1125 host_impl_->ClearCurrentlyScrollingLayerForTesting();
1126 EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler()); 1121 EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
1127 } 1122 }
1128 1123
1129 TEST_F(LayerTreeHostImplTest, ScrollByReturnsCorrectValue) { 1124 TEST_F(LayerTreeHostImplTest, ScrollByReturnsCorrectValue) {
1130 SetupScrollAndContentsLayers(gfx::Size(200, 200)); 1125 SetupScrollAndContentsLayers(gfx::Size(200, 200));
1131 host_impl_->SetViewportSize(gfx::Size(100, 100)); 1126 host_impl_->SetViewportSize(gfx::Size(100, 100));
1132 1127
1133 DrawFrame(); 1128 DrawFrame();
1134 1129
1135 InputHandler::ScrollStatus status = host_impl_->ScrollBegin( 1130 InputHandler::ScrollStatus status = host_impl_->ScrollBegin(
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
2822 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 2817 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
2823 InputHandler::WHEEL); 2818 InputHandler::WHEEL);
2824 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get()); 2819 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get());
2825 EXPECT_FALSE(did_request_next_frame_); 2820 EXPECT_FALSE(did_request_next_frame_);
2826 EXPECT_TRUE(did_request_redraw_); 2821 EXPECT_TRUE(did_request_redraw_);
2827 did_request_redraw_ = false; 2822 did_request_redraw_ = false;
2828 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); 2823 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
2829 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 2824 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
2830 2825
2831 host_impl_->ScrollEnd(EndState().get()); 2826 host_impl_->ScrollEnd(EndState().get());
2832 host_impl_->ClearCurrentlyScrollingLayerForTesting();
2833 EXPECT_FALSE(did_request_next_frame_); 2827 EXPECT_FALSE(did_request_next_frame_);
2834 EXPECT_FALSE(did_request_redraw_); 2828 EXPECT_FALSE(did_request_redraw_);
2835 if (expecting_animations) { 2829 if (expecting_animations) {
2836 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), 2830 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20),
2837 requested_animation_delay_); 2831 requested_animation_delay_);
2838 EXPECT_FALSE(animation_task_.Equals(base::Closure())); 2832 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
2839 } else { 2833 } else {
2840 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); 2834 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
2841 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 2835 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
2842 } 2836 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2917 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 2911 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
2918 InputHandler::WHEEL); 2912 InputHandler::WHEEL);
2919 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(5, 0)).get()); 2913 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(5, 0)).get());
2920 EXPECT_FALSE(did_request_next_frame_); 2914 EXPECT_FALSE(did_request_next_frame_);
2921 EXPECT_TRUE(did_request_redraw_); 2915 EXPECT_TRUE(did_request_redraw_);
2922 did_request_redraw_ = false; 2916 did_request_redraw_ = false;
2923 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); 2917 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
2924 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 2918 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
2925 2919
2926 host_impl_->ScrollEnd(EndState().get()); 2920 host_impl_->ScrollEnd(EndState().get());
2927 host_impl_->ClearCurrentlyScrollingLayerForTesting();
2928 EXPECT_FALSE(did_request_next_frame_); 2921 EXPECT_FALSE(did_request_next_frame_);
2929 EXPECT_FALSE(did_request_redraw_); 2922 EXPECT_FALSE(did_request_redraw_);
2930 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); 2923 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
2931 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 2924 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
2932 2925
2933 // Changing page scale triggers scrollbar animation. 2926 // Changing page scale triggers scrollbar animation.
2934 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); 2927 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f);
2935 host_impl_->active_tree()->SetPageScaleOnActiveTree(1.1f); 2928 host_impl_->active_tree()->SetPageScaleOnActiveTree(1.1f);
2936 EXPECT_FALSE(did_request_next_frame_); 2929 EXPECT_FALSE(did_request_next_frame_);
2937 EXPECT_FALSE(did_request_redraw_); 2930 EXPECT_FALSE(did_request_redraw_);
(...skipping 6424 matching lines...) Expand 10 before | Expand all | Expand 10 after
9362 host_impl_->FlingScrollBegin().thread); 9355 host_impl_->FlingScrollBegin().thread);
9363 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9356 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9364 9357
9365 gfx::Vector2d scroll_delta(inner_viewport.width() / 2.f, 9358 gfx::Vector2d scroll_delta(inner_viewport.width() / 2.f,
9366 inner_viewport.height() / 2.f); 9359 inner_viewport.height() / 2.f);
9367 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); 9360 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
9368 inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y()); 9361 inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
9369 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9362 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9370 9363
9371 host_impl_->ScrollEnd(EndState().get()); 9364 host_impl_->ScrollEnd(EndState().get());
9372 host_impl_->ClearCurrentlyScrollingLayerForTesting();
9373 EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer()); 9365 EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer());
9374 9366
9375 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); 9367 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
9376 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); 9368 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset());
9377 9369
9378 // Fling past the inner viewport boundry, make sure outer viewport scrolls. 9370 // Fling past the inner viewport boundry, make sure outer viewport scrolls.
9379 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, 9371 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
9380 host_impl_ 9372 host_impl_
9381 ->ScrollBegin(BeginState(gfx::Point()).get(), 9373 ->ScrollBegin(BeginState(gfx::Point()).get(),
9382 InputHandler::TOUCHSCREEN) 9374 InputHandler::TOUCHSCREEN)
9383 .thread); 9375 .thread);
9384 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9376 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9385 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, 9377 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
9386 host_impl_->FlingScrollBegin().thread); 9378 host_impl_->FlingScrollBegin().thread);
9387 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9379 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9388 9380
9389 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); 9381 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
9390 inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y()); 9382 inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
9391 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9383 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9392 9384
9393 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); 9385 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
9394 outer_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y()); 9386 outer_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
9395 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9387 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9396 9388
9397 host_impl_->ScrollEnd(EndState().get()); 9389 host_impl_->ScrollEnd(EndState().get());
9398 host_impl_->ClearCurrentlyScrollingLayerForTesting();
9399 EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer()); 9390 EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer());
9400 9391
9401 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); 9392 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
9402 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); 9393 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset());
9403 } 9394 }
9404 } 9395 }
9405 9396
9406 TEST_F(LayerTreeHostImplVirtualViewportTest, 9397 TEST_F(LayerTreeHostImplVirtualViewportTest,
9407 DiagonalScrollBubblesPerfectlyToInner) { 9398 DiagonalScrollBubblesPerfectlyToInner) {
9408 gfx::Size content_size = gfx::Size(200, 320); 9399 gfx::Size content_size = gfx::Size(200, 320);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
9446 // Now diagonal scroll across the outer viewport boundary in a single event. 9437 // Now diagonal scroll across the outer viewport boundary in a single event.
9447 // The entirety of the scroll should be consumed, as bubbling between inner 9438 // The entirety of the scroll should be consumed, as bubbling between inner
9448 // and outer viewport layers is perfect. 9439 // and outer viewport layers is perfect.
9449 host_impl_->ScrollBy( 9440 host_impl_->ScrollBy(
9450 UpdateState(gfx::Point(), gfx::ScaleVector2d(scroll_delta, 2)).get()); 9441 UpdateState(gfx::Point(), gfx::ScaleVector2d(scroll_delta, 2)).get());
9451 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt( 9442 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(
9452 gfx::Point(), InputHandler::TOUCHSCREEN)); 9443 gfx::Point(), InputHandler::TOUCHSCREEN));
9453 outer_expected += scroll_delta; 9444 outer_expected += scroll_delta;
9454 inner_expected += scroll_delta; 9445 inner_expected += scroll_delta;
9455 host_impl_->ScrollEnd(EndState().get()); 9446 host_impl_->ScrollEnd(EndState().get());
9456 host_impl_->ClearCurrentlyScrollingLayerForTesting();
9457 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt( 9447 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
9458 gfx::Point(), InputHandler::TOUCHSCREEN)); 9448 gfx::Point(), InputHandler::TOUCHSCREEN));
9459 9449
9460 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); 9450 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
9461 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); 9451 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset());
9462 } 9452 }
9463 } 9453 }
9464 9454
9465 TEST_F(LayerTreeHostImplVirtualViewportTest, 9455 TEST_F(LayerTreeHostImplVirtualViewportTest,
9466 TouchFlingDoesntSwitchScrollingLayer) { 9456 TouchFlingDoesntSwitchScrollingLayer) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
9519 EXPECT_TRUE( 9509 EXPECT_TRUE(
9520 ScrollInfoContains(*scroll_info, child_scroll->id(), scroll_delta)); 9510 ScrollInfoContains(*scroll_info, child_scroll->id(), scroll_delta));
9521 ExpectNone(*scroll_info, inner_scroll->id()); 9511 ExpectNone(*scroll_info, inner_scroll->id());
9522 9512
9523 // As the locked layer is at its limit, no further scrolling can occur. 9513 // As the locked layer is at its limit, no further scrolling can occur.
9524 EXPECT_FALSE( 9514 EXPECT_FALSE(
9525 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()) 9515 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get())
9526 .did_scroll); 9516 .did_scroll);
9527 EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_scroll); 9517 EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_scroll);
9528 host_impl_->ScrollEnd(EndState().get()); 9518 host_impl_->ScrollEnd(EndState().get());
9529 host_impl_->ClearCurrentlyScrollingLayerForTesting();
9530 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt( 9519 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
9531 gfx::Point(), InputHandler::TOUCHSCREEN)); 9520 gfx::Point(), InputHandler::TOUCHSCREEN));
9532 } 9521 }
9533 } 9522 }
9534 9523
9535 TEST_F(LayerTreeHostImplVirtualViewportTest, 9524 TEST_F(LayerTreeHostImplVirtualViewportTest,
9536 ScrollBeginEventThatTargetsViewportLayerSkipsHitTest) { 9525 ScrollBeginEventThatTargetsViewportLayerSkipsHitTest) {
9537 gfx::Size content_size = gfx::Size(100, 160); 9526 gfx::Size content_size = gfx::Size(100, 160);
9538 gfx::Size outer_viewport = gfx::Size(50, 80); 9527 gfx::Size outer_viewport = gfx::Size(50, 80);
9539 gfx::Size inner_viewport = gfx::Size(25, 40); 9528 gfx::Size inner_viewport = gfx::Size(25, 40);
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
10103 InputHandler::WHEEL) 10092 InputHandler::WHEEL)
10104 .thread); 10093 .thread);
10105 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y), 10094 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y),
10106 InputHandler::WHEEL)); 10095 InputHandler::WHEEL));
10107 host_impl_->ScrollBy( 10096 host_impl_->ScrollBy(
10108 UpdateState(gfx::Point(0, y), gfx::Vector2d(0, 50)).get()); 10097 UpdateState(gfx::Point(0, y), gfx::Vector2d(0, 50)).get());
10109 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y + 50), 10098 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y + 50),
10110 InputHandler::WHEEL)); 10099 InputHandler::WHEEL));
10111 std::unique_ptr<ScrollState> scroll_state_end = EndState(); 10100 std::unique_ptr<ScrollState> scroll_state_end = EndState();
10112 host_impl_->ScrollEnd(scroll_state_end.get()); 10101 host_impl_->ScrollEnd(scroll_state_end.get());
10113 host_impl_->ClearCurrentlyScrollingLayerForTesting();
10114 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), 10102 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
10115 InputHandler::WHEEL)); 10103 InputHandler::WHEEL));
10116 10104
10117 // The instant scroll should have marked the smooth scroll animation as 10105 // The instant scroll should have marked the smooth scroll animation as
10118 // aborted. 10106 // aborted.
10119 EXPECT_FALSE(host_impl_->animation_host()->HasActiveAnimationForTesting( 10107 EXPECT_FALSE(host_impl_->animation_host()->HasActiveAnimationForTesting(
10120 scrolling_layer->element_id())); 10108 scrolling_layer->element_id()));
10121 10109
10122 EXPECT_VECTOR2DF_EQ(gfx::ScrollOffset(0, y + 50), 10110 EXPECT_VECTOR2DF_EQ(gfx::ScrollOffset(0, y + 50),
10123 scrolling_layer->CurrentScrollOffset()); 10111 scrolling_layer->CurrentScrollOffset());
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
11149 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 11137 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
11150 11138
11151 // Re-initialize with a software output surface. 11139 // Re-initialize with a software output surface.
11152 output_surface_ = FakeOutputSurface::CreateDelegatingSoftware(); 11140 output_surface_ = FakeOutputSurface::CreateDelegatingSoftware();
11153 host_impl_->InitializeRenderer(output_surface_.get()); 11141 host_impl_->InitializeRenderer(output_surface_.get());
11154 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 11142 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
11155 } 11143 }
11156 11144
11157 } // namespace 11145 } // namespace
11158 } // namespace cc 11146 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698