| Index: cc/trees/layer_tree_host_impl_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
|
| index 818c97e54d79a4b6691edee3dbba4b8ca40b894e..93c1e475f9f34e54789d796e8be8a49f9b626b88 100644
|
| --- a/cc/trees/layer_tree_host_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc
|
| @@ -505,7 +505,8 @@ TEST_F(LayerTreeHostImplTest, ScrollRootCallsCommitAndRedraw) {
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
|
| EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
|
| InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10),
|
| InputHandler::WHEEL));
|
| host_impl_->ScrollEnd();
|
| @@ -523,7 +524,8 @@ TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) {
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
|
| EXPECT_FALSE(host_impl_->IsActivelyScrolling());
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(host_impl_->IsActivelyScrolling());
|
| host_impl_->ScrollEnd();
|
| EXPECT_FALSE(host_impl_->IsActivelyScrolling());
|
| @@ -567,7 +569,8 @@ TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) {
|
| // We should still be scrolling, because the scrolled layer also exists in the
|
| // new tree.
|
| gfx::Vector2d scroll_delta(0, 10);
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
| scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas();
|
| ExpectContains(*scroll_info, scroll_layer->id(), scroll_delta);
|
| @@ -839,7 +842,8 @@ TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) {
|
| host_impl_->ScrollBegin(gfx::Point(75, 75), InputHandler::WHEEL));
|
| EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
|
| InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(25, 25),
|
| InputHandler::GESTURE));
|
| host_impl_->ScrollEnd();
|
| @@ -849,7 +853,8 @@ TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) {
|
| host_impl_->ScrollBegin(gfx::Point(75, 75), InputHandler::GESTURE));
|
| EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
|
| InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
| EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
|
| InputHandler::GESTURE));
|
| @@ -872,7 +877,8 @@ TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionWithOffset) {
|
| host_impl_->ScrollBegin(gfx::Point(40, 10), InputHandler::WHEEL));
|
| EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(40, 10),
|
| InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 1));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 1),
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // This point is still inside the non-fast region.
|
| @@ -916,40 +922,111 @@ TEST_F(LayerTreeHostImplTest, ScrollByReturnsCorrectValue) {
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
|
|
| // Trying to scroll to the left/top will not succeed.
|
| - EXPECT_FALSE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0)).did_scroll);
|
| - EXPECT_FALSE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10)).did_scroll);
|
| - EXPECT_FALSE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, -10)).did_scroll);
|
| + EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| + EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| + EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, -10),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
|
|
| // Scrolling to the right/bottom will succeed.
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, 0)).did_scroll);
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)).did_scroll);
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, 10)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, 0),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, 10),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
|
|
| // Scrolling to left/top will now succeed.
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0)).did_scroll);
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10)).did_scroll);
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, -10)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, -10),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
|
|
| // Scrolling diagonally against an edge will succeed.
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, -10)).did_scroll);
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0)).did_scroll);
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 10)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, -10),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 10),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
|
|
| // Trying to scroll more than the available space will also succeed.
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(5000, 5000)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(5000, 5000),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| +}
|
| +
|
| +TEST_F(LayerTreeHostImplTest, ScrollByRespectsRails) {
|
| + LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(200, 200));
|
| + host_impl_->SetViewportSize(gfx::Size(100, 100));
|
| + DrawFrame();
|
| + InputHandlerScrollResult result;
|
| +
|
| + EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| + host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
|
| +
|
| + // A free scroll.
|
| + result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(1, 2),
|
| + InputHandler::RAILS_MODE_FREE);
|
| + EXPECT_TRUE(result.did_scroll);
|
| + EXPECT_FALSE(result.did_overscroll_root);
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(1, 2), scroll_layer->CurrentScrollOffset());
|
| +
|
| + // A vertically railed scroll.
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(1, 2),
|
| + InputHandler::RAILS_MODE_VERTICAL);
|
| + EXPECT_TRUE(result.did_scroll);
|
| + EXPECT_FALSE(result.did_overscroll_root);
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(1, 4), scroll_layer->CurrentScrollOffset());
|
| +
|
| + // A horizontally railed scroll.
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(1, 2),
|
| + InputHandler::RAILS_MODE_HORIZONTAL);
|
| + EXPECT_TRUE(result.did_scroll);
|
| + EXPECT_FALSE(result.did_overscroll_root);
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(2, 4), scroll_layer->CurrentScrollOffset());
|
| +
|
| + // A horizontally railed scroll which has no horizontal component.
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 2),
|
| + InputHandler::RAILS_MODE_HORIZONTAL);
|
| + EXPECT_TRUE(result.did_scroll);
|
| + EXPECT_FALSE(result.did_overscroll_root);
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(2, 4), scroll_layer->CurrentScrollOffset());
|
| +
|
| + // A free scroll to return to the document's edge, so we can test overscroll.
|
| + result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-2, -4),
|
| + InputHandler::RAILS_MODE_FREE);
|
| + EXPECT_TRUE(result.did_scroll);
|
| + EXPECT_FALSE(result.did_overscroll_root);
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0), scroll_layer->CurrentScrollOffset());
|
| +
|
| + // A horizontally railed overscroll with a vertical component in overscroll
|
| + // direction.
|
| + result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-1, -2),
|
| + InputHandler::RAILS_MODE_HORIZONTAL);
|
| + EXPECT_FALSE(result.did_scroll);
|
| + EXPECT_TRUE(result.did_overscroll_root);
|
| + EXPECT_EQ(gfx::Vector2dF(-1, 0), result.unused_scroll_delta);
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0), scroll_layer->CurrentScrollOffset());
|
| +
|
| + // A horizontally railed overscroll with a vertical component in scroll
|
| + // direction.
|
| + result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-1, 2),
|
| + InputHandler::RAILS_MODE_HORIZONTAL);
|
| + EXPECT_FALSE(result.did_scroll);
|
| + EXPECT_TRUE(result.did_overscroll_root);
|
| + EXPECT_EQ(gfx::Vector2dF(-1, 0), result.unused_scroll_delta);
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0), scroll_layer->CurrentScrollOffset());
|
| +
|
| + // A vertically railed scroll with a horizontal component in overscroll
|
| + // direction.
|
| + result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-1, 2),
|
| + InputHandler::RAILS_MODE_VERTICAL);
|
| + EXPECT_TRUE(result.did_scroll);
|
| + EXPECT_FALSE(result.did_overscroll_root);
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 2), scroll_layer->CurrentScrollOffset());
|
| }
|
|
|
| TEST_F(LayerTreeHostImplTest, ScrollVerticallyByPageReturnsCorrectValue) {
|
| @@ -1007,7 +1084,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), overflow->CurrentScrollOffset());
|
|
|
| gfx::Vector2dF scroll_delta(10, 10);
|
| - host_impl_->ScrollBy(scroll_position, scroll_delta);
|
| + host_impl_->ScrollBy(scroll_position, scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 10), overflow->CurrentScrollOffset());
|
| @@ -1019,7 +1097,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 10), overflow->CurrentScrollOffset());
|
|
|
| - host_impl_->ScrollBy(scroll_position, scroll_delta);
|
| + host_impl_->ScrollBy(scroll_position, scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 0), scroll_layer->CurrentScrollOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset());
|
| @@ -1031,7 +1110,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 0), scroll_layer->CurrentScrollOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset());
|
|
|
| - host_impl_->ScrollBy(scroll_position, scroll_delta);
|
| + host_impl_->ScrollBy(scroll_position, scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(20, 10), scroll_layer->CurrentScrollOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset());
|
| @@ -1094,7 +1174,8 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
|
| gfx::Vector2d scroll_delta(0, 10);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| scoped_ptr<ScrollAndScaleSet> scroll_info =
|
| @@ -1113,7 +1194,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) {
|
| SetupScrollAndContentsLayers(gfx::Size(100, 100));
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->QueueSwapPromiseForMainThreadScrollUpdate(swap_promise.Pass());
|
| host_impl_->ScrollEnd();
|
|
|
| @@ -1228,7 +1310,8 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
|
| host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE);
|
| host_impl_->PinchGestureBegin();
|
| host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10));
|
| - host_impl_->ScrollBy(gfx::Point(10, 10), gfx::Vector2d(-10, -10));
|
| + host_impl_->ScrollBy(gfx::Point(10, 10), gfx::Vector2d(-10, -10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20));
|
| host_impl_->PinchGestureEnd();
|
| host_impl_->ScrollEnd();
|
| @@ -1250,7 +1333,8 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
|
| host_impl_->PinchGestureBegin();
|
| host_impl_->PinchGestureUpdate(2.f, gfx::Point(0, 0));
|
| host_impl_->PinchGestureUpdate(1.f, gfx::Point(0, 0));
|
| - host_impl_->ScrollBy(gfx::Point(0, 0), gfx::Vector2d(10, 10));
|
| + host_impl_->ScrollBy(gfx::Point(0, 0), gfx::Vector2d(10, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->PinchGestureUpdate(1.f, gfx::Point(10, 10));
|
| host_impl_->PinchGestureEnd();
|
| host_impl_->ScrollEnd();
|
| @@ -1640,7 +1724,8 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
|
| // After a scroll, a scrollbar animation should be scheduled about 20ms from
|
| // now.
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 5));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 5),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_FALSE(did_request_animate_);
|
| EXPECT_TRUE(did_request_redraw_);
|
| did_request_redraw_ = false;
|
| @@ -1685,7 +1770,8 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
|
|
|
| // Scrollbar animation is not triggered unnecessarily.
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_FALSE(did_request_animate_);
|
| EXPECT_TRUE(did_request_redraw_);
|
| did_request_redraw_ = false;
|
| @@ -1833,7 +1919,8 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) {
|
| // Scrolling should update metadata immediately.
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| {
|
| CompositorFrameMetadata metadata =
|
| host_impl_->MakeCompositorFrameMetadata();
|
| @@ -2650,7 +2737,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
|
|
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, 50.f));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, 50.f),
|
| + InputHandler::RAILS_MODE_FREE);
|
|
|
| // The entire scroll delta should have been used to hide the top controls.
|
| // The viewport layers should be resized back to their full sizes.
|
| @@ -2660,7 +2748,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
|
| EXPECT_EQ(100.f, outer_container->BoundsForScrolling().height());
|
|
|
| // The inner viewport should be scrollable by 50px * page_scale.
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, 100.f));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, 100.f),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(50.f, inner_scroll->CurrentScrollOffset().y());
|
| EXPECT_EQ(0.f, outer_scroll->CurrentScrollOffset().y());
|
| EXPECT_EQ(gfx::ScrollOffset(), outer_scroll->MaxScrollOffset());
|
| @@ -2671,7 +2760,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), inner_scroll);
|
|
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -50.f));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -50.f),
|
| + InputHandler::RAILS_MODE_FREE);
|
|
|
| // The entire scroll delta should have been used to show the top controls.
|
| // The outer viewport should be resized to accomodate and scrolled to the
|
| @@ -2684,15 +2774,18 @@ TEST_F(LayerTreeHostImplTopControlsTest,
|
|
|
| // Now when we continue scrolling, make sure the outer viewport gets scrolled
|
| // since it wasn't scrollable when the scroll began.
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -20.f));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -20.f),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(15.f, outer_scroll->CurrentScrollOffset().y());
|
| EXPECT_EQ(25.f, inner_scroll->CurrentScrollOffset().y());
|
|
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -30.f));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -30.f),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(0.f, outer_scroll->CurrentScrollOffset().y());
|
| EXPECT_EQ(25.f, inner_scroll->CurrentScrollOffset().y());
|
|
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -50.f));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -50.f),
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| EXPECT_EQ(0.f, outer_scroll->CurrentScrollOffset().y());
|
| @@ -2788,7 +2881,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollableSublayer) {
|
| gfx::Vector2dF scroll_delta(0.f, 25.f);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // Top controls should be hidden
|
| @@ -2937,7 +3031,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
|
| gfx::Vector2dF scroll_delta(0.f, 25.f);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
|
|
| // scrolling down at the max extents no longer hides the top controls
|
| EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
|
| @@ -2963,7 +3058,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
|
| scroll_delta = gfx::Vector2dF(0.f, -25.f);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // The viewport offset shouldn't have changed.
|
| @@ -2990,7 +3086,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsAspectRatio) {
|
| gfx::Vector2dF scroll_delta(0.f, 25.f);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| EXPECT_FLOAT_EQ(scroll_delta.y(),
|
| @@ -3028,7 +3125,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
|
| gfx::Vector2dF scroll_delta(0.f, 15.f);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(host_impl_->OuterViewportScrollLayer(),
|
| host_impl_->CurrentlyScrollingLayer());
|
| host_impl_->ScrollEnd();
|
| @@ -3040,7 +3138,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
|
| scroll_delta = gfx::Vector2dF(0.f, 50.f);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
|
|
| EXPECT_EQ(0, host_impl_->top_controls_manager()->ContentTopOffset());
|
| EXPECT_EQ(host_impl_->OuterViewportScrollLayer(),
|
| @@ -3056,7 +3155,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
|
| scroll_delta = gfx::Vector2dF(0.f, -65.f);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
|
|
| EXPECT_EQ(top_controls_height_,
|
| host_impl_->top_controls_manager()->ContentTopOffset());
|
| @@ -3153,7 +3253,8 @@ TEST_F(LayerTreeHostImplTest, ScrollNonCompositedRoot) {
|
|
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
| EXPECT_TRUE(did_request_redraw_);
|
| EXPECT_TRUE(did_request_commit_);
|
| @@ -3173,7 +3274,8 @@ TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) {
|
|
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
| EXPECT_TRUE(did_request_redraw_);
|
| EXPECT_TRUE(did_request_commit_);
|
| @@ -3280,7 +3382,8 @@ TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnMainThread) {
|
| gfx::ScrollOffset expected_max_scroll = root_scroll->MaxScrollOffset();
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // Set new page scale from main thread.
|
| @@ -3331,7 +3434,8 @@ TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnImplThread) {
|
| gfx::ScrollOffset expected_max_scroll = root_scroll->MaxScrollOffset();
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // Set new page scale on impl thread by pinching.
|
| @@ -3442,7 +3546,8 @@ TEST_F(LayerTreeHostImplTest, ScrollChildAndChangePageScaleOnMainThread) {
|
| gfx::ScrollOffset expected_max_scroll(child->MaxScrollOffset());
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| float page_scale = 2.f;
|
| @@ -3493,7 +3598,8 @@ TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) {
|
| gfx::Vector2d scroll_delta(-8, -7);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| scoped_ptr<ScrollAndScaleSet> scroll_info =
|
| @@ -3547,7 +3653,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(),
|
| InputHandler::NON_BUBBLING_GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| scoped_ptr<ScrollAndScaleSet> scroll_info =
|
| @@ -3568,7 +3675,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
|
| host_impl_->ScrollBegin(gfx::Point(5, 5),
|
| InputHandler::NON_BUBBLING_GESTURE));
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child);
|
| host_impl_->ScrollEnd();
|
|
|
| @@ -3587,7 +3695,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
|
| host_impl_->ScrollBegin(gfx::Point(5, 5),
|
| InputHandler::NON_BUBBLING_GESTURE));
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
|
| host_impl_->ScrollEnd();
|
|
|
| @@ -3609,7 +3718,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
|
| host_impl_->ScrollBegin(gfx::Point(1, 1),
|
| InputHandler::NON_BUBBLING_GESTURE));
|
| EXPECT_EQ(grand_child, host_impl_->CurrentlyScrollingLayer());
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| scroll_info = host_impl_->ProcessScrollDeltas();
|
| @@ -3649,7 +3759,8 @@ TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) {
|
| gfx::Vector2d scroll_delta(0, 4);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| scoped_ptr<ScrollAndScaleSet> scroll_info =
|
| @@ -3713,7 +3824,8 @@ TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
|
| gfx::Vector2d gesture_scroll_delta(10, 0);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // The layer should have scrolled down in its local coordinates.
|
| @@ -3726,7 +3838,8 @@ TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
|
| gfx::Vector2d wheel_scroll_delta(0, 10);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // The layer should have scrolled down in its local coordinates.
|
| @@ -3773,7 +3886,8 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) {
|
| gfx::Vector2d gesture_scroll_delta(0, 10);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(1, 1), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // The child layer should have scrolled down in its local coordinates an
|
| @@ -3795,7 +3909,8 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) {
|
| gfx::Vector2d gesture_scroll_delta(10, 0);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(1, 1), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // The child layer should have scrolled down in its local coordinates an
|
| @@ -3837,7 +3952,8 @@ TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) {
|
| gfx::Vector2d scroll_delta(0, 10);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // The layer should have scrolled down in its local coordinates, but half the
|
| @@ -3852,7 +3968,8 @@ TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) {
|
| gfx::Vector2d wheel_scroll_delta(0, 10);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
|
|
| // It should apply the scale factor to the scroll delta for the wheel event.
|
| @@ -4005,13 +4122,15 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) {
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
|
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(ScrollOffsetWithDelta(current_offset, scroll_delta),
|
| scroll_delegate.last_set_scroll_offset());
|
|
|
| current_offset = gfx::ScrollOffset(42.f, 41.f);
|
| scroll_delegate.set_getter_return_value(current_offset);
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(current_offset + gfx::ScrollOffset(scroll_delta),
|
| scroll_delegate.last_set_scroll_offset());
|
| host_impl_->ScrollEnd();
|
| @@ -4086,14 +4205,16 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| // In-bounds scrolling does not affect overscroll.
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(scroll_result.did_scroll);
|
| EXPECT_FALSE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(), scroll_result.unused_scroll_delta);
|
| EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
|
|
|
| // Overscroll events are reflected immediately.
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 50));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 50),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(scroll_result.did_scroll);
|
| EXPECT_TRUE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(0, 10), scroll_result.unused_scroll_delta);
|
| @@ -4102,7 +4223,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| host_impl_->accumulated_root_overscroll());
|
|
|
| // In-bounds scrolling resets accumulated overscroll for the scrolled axes.
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -50));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -50),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(scroll_result.did_scroll);
|
| EXPECT_FALSE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(), scroll_result.unused_scroll_delta);
|
| @@ -4110,7 +4232,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| EXPECT_EQ(scroll_result.accumulated_root_overscroll,
|
| host_impl_->accumulated_root_overscroll());
|
|
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_FALSE(scroll_result.did_scroll);
|
| EXPECT_TRUE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(0, -10), scroll_result.unused_scroll_delta);
|
| @@ -4118,7 +4241,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| EXPECT_EQ(scroll_result.accumulated_root_overscroll,
|
| host_impl_->accumulated_root_overscroll());
|
|
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, 0));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, 0),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(scroll_result.did_scroll);
|
| EXPECT_FALSE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(0, 0), scroll_result.unused_scroll_delta);
|
| @@ -4126,7 +4250,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| EXPECT_EQ(scroll_result.accumulated_root_overscroll,
|
| host_impl_->accumulated_root_overscroll());
|
|
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-15, 0));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-15, 0),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(scroll_result.did_scroll);
|
| EXPECT_TRUE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(-5, 0), scroll_result.unused_scroll_delta);
|
| @@ -4134,7 +4259,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| EXPECT_EQ(scroll_result.accumulated_root_overscroll,
|
| host_impl_->accumulated_root_overscroll());
|
|
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 60));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 60),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(scroll_result.did_scroll);
|
| EXPECT_TRUE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(0, 10), scroll_result.unused_scroll_delta);
|
| @@ -4142,7 +4268,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| EXPECT_EQ(scroll_result.accumulated_root_overscroll,
|
| host_impl_->accumulated_root_overscroll());
|
|
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, -60));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, -60),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(scroll_result.did_scroll);
|
| EXPECT_TRUE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(0, -10), scroll_result.unused_scroll_delta);
|
| @@ -4152,7 +4279,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
|
|
| // Overscroll accumulates within the scope of ScrollBegin/ScrollEnd as long
|
| // as no scroll occurs.
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -20));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -20),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_FALSE(scroll_result.did_scroll);
|
| EXPECT_TRUE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(0, -20), scroll_result.unused_scroll_delta);
|
| @@ -4160,7 +4288,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| EXPECT_EQ(scroll_result.accumulated_root_overscroll,
|
| host_impl_->accumulated_root_overscroll());
|
|
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -20));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -20),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_FALSE(scroll_result.did_scroll);
|
| EXPECT_TRUE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(0, -20), scroll_result.unused_scroll_delta);
|
| @@ -4169,7 +4298,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| host_impl_->accumulated_root_overscroll());
|
|
|
| // Overscroll resets on valid scroll.
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(scroll_result.did_scroll);
|
| EXPECT_FALSE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(0, 0), scroll_result.unused_scroll_delta);
|
| @@ -4177,7 +4307,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| EXPECT_EQ(scroll_result.accumulated_root_overscroll,
|
| host_impl_->accumulated_root_overscroll());
|
|
|
| - scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -20));
|
| + scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -20),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_TRUE(scroll_result.did_scroll);
|
| EXPECT_TRUE(scroll_result.did_overscroll_root);
|
| EXPECT_EQ(gfx::Vector2dF(0, -10), scroll_result.unused_scroll_delta);
|
| @@ -4222,7 +4353,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(),
|
| InputHandler::NON_BUBBLING_GESTURE));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
|
| host_impl_->ScrollEnd();
|
|
|
| @@ -4234,7 +4366,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
|
| InputHandler::NON_BUBBLING_GESTURE));
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
|
| EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_layer);
|
| EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
|
| host_impl_->ScrollEnd();
|
| @@ -4246,7 +4379,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
|
| host_impl_->ScrollBegin(gfx::Point(5, 5),
|
| InputHandler::NON_BUBBLING_GESTURE));
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
|
| EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
|
| host_impl_->ScrollEnd();
|
| @@ -4283,11 +4417,14 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildEventBubbling) {
|
| gfx::Vector2d scroll_delta(0, 8);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF(0, 6), host_impl_->accumulated_root_overscroll());
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF(0, 14), host_impl_->accumulated_root_overscroll());
|
| host_impl_->ScrollEnd();
|
| }
|
| @@ -4308,7 +4445,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollAlways) {
|
| // Even though the layer can't scroll the overscroll still happens.
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF(0, 10), host_impl_->accumulated_root_overscroll());
|
| }
|
|
|
| @@ -4346,7 +4484,8 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollOnFractionalDeviceScale) {
|
| // vertical GlowEffect should not be applied in about:blank page.
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, -1));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, -1),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF().ToString(),
|
| host_impl_->accumulated_root_overscroll().ToString());
|
|
|
| @@ -4383,10 +4522,12 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
|
| // called while scrolling up without reaching the edge of the content.
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 100));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 100),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF().ToString(),
|
| host_impl_->accumulated_root_overscroll().ToString());
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, -2.30f));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, -2.30f),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF().ToString(),
|
| host_impl_->accumulated_root_overscroll().ToString());
|
| host_impl_->ScrollEnd();
|
| @@ -4396,11 +4537,13 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
|
| host_impl_->ScrollBegin(gfx::Point(0, 0),
|
| InputHandler::NON_BUBBLING_GESTURE));
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 20));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 20),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF(0.000000f, 17.699997f).ToString(),
|
| host_impl_->accumulated_root_overscroll().ToString());
|
|
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.02f, -0.01f));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.02f, -0.01f),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF(0.000000f, 17.699997f).ToString(),
|
| host_impl_->accumulated_root_overscroll().ToString());
|
| host_impl_->ScrollEnd();
|
| @@ -4408,7 +4551,8 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
|
| // gloweffect without reaching edge.
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL));
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(-0.12f, 0.1f));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(-0.12f, 0.1f),
|
| + InputHandler::RAILS_MODE_FREE);
|
| EXPECT_EQ(gfx::Vector2dF().ToString(),
|
| host_impl_->accumulated_root_overscroll().ToString());
|
| host_impl_->ScrollEnd();
|
| @@ -6928,8 +7072,10 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldNotBubble) {
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
|
|
|
| gfx::Vector2d scroll_delta(0, 100);
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
|
|
| host_impl_->ScrollEnd();
|
|
|
| @@ -6975,7 +7121,8 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldLockToFirstScrolledLayer) {
|
| gfx::Vector2d scroll_delta(0, -2);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
|
|
| // The grand child should have scrolled up to its limit.
|
| scroll_info = host_impl_->ProcessScrollDeltas();
|
| @@ -6985,7 +7132,8 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldLockToFirstScrolledLayer) {
|
|
|
| // The child should have received the bubbled delta, but the locked
|
| // scrolling layer should remain set as the grand child.
|
| - EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| scroll_info = host_impl_->ProcessScrollDeltas();
|
| ASSERT_EQ(2u, scroll_info->scrolls.size());
|
| ExpectContains(*scroll_info, grand_child->id(), scroll_delta);
|
| @@ -6995,7 +7143,8 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldLockToFirstScrolledLayer) {
|
| // The first |ScrollBy| after the fling should re-lock the scrolling
|
| // layer to the first layer that scrolled, which is the child.
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
|
| - EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child);
|
|
|
| // The child should have scrolled up to its limit.
|
| @@ -7005,7 +7154,9 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldLockToFirstScrolledLayer) {
|
| ExpectContains(*scroll_info, child->id(), scroll_delta + scroll_delta);
|
|
|
| // As the locked layer is at it's limit, no further scrolling can occur.
|
| - EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
|
| + EXPECT_FALSE(
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child);
|
| host_impl_->ScrollEnd();
|
| }
|
| @@ -7039,8 +7190,10 @@ TEST_F(LayerTreeHostImplTest, WheelFlingShouldBubble) {
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
|
|
|
| gfx::Vector2d scroll_delta(0, 100);
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
|
|
| host_impl_->ScrollEnd();
|
|
|
| @@ -7439,8 +7592,8 @@ TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) {
|
| // Scrolling normally should not trigger any forwarding.
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| host_impl_->ScrollEnd();
|
|
|
| EXPECT_EQ(0, set_needs_commit_count);
|
| @@ -7452,8 +7605,8 @@ TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) {
|
| scroll_layer->SetHaveScrollEventHandlers(true);
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| host_impl_->ScrollEnd();
|
|
|
| EXPECT_EQ(0, set_needs_commit_count);
|
| @@ -7534,8 +7687,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
|
| // Scroll just the top controls and verify that the scroll succeeds.
|
| const float residue = 10;
|
| float offset = top_controls_height_ - residue;
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_FLOAT_EQ(-offset,
|
| host_impl_->top_controls_manager()->ControlsTopOffset());
|
| EXPECT_EQ(gfx::Vector2dF().ToString(),
|
| @@ -7544,8 +7697,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
|
| // Scroll across the boundary
|
| const float content_scroll = 20;
|
| offset = residue + content_scroll;
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(-top_controls_height_,
|
| host_impl_->top_controls_manager()->ControlsTopOffset());
|
| EXPECT_EQ(gfx::Vector2dF(0, content_scroll).ToString(),
|
| @@ -7553,8 +7706,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
|
|
|
| // Now scroll back to the top of the content
|
| offset = -content_scroll;
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(-top_controls_height_,
|
| host_impl_->top_controls_manager()->ControlsTopOffset());
|
| EXPECT_EQ(gfx::Vector2dF().ToString(),
|
| @@ -7562,15 +7715,15 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
|
|
|
| // And scroll the top controls completely into view
|
| offset = -top_controls_height_;
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
|
| EXPECT_EQ(gfx::Vector2dF().ToString(),
|
| scroll_layer->CurrentScrollOffset().ToString());
|
|
|
| // And attempt to scroll past the end
|
| - EXPECT_FALSE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
|
| EXPECT_EQ(gfx::Vector2dF().ToString(),
|
| scroll_layer->CurrentScrollOffset().ToString());
|
| @@ -7594,8 +7747,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
|
| // Scroll the top controls partially.
|
| const float residue = 35;
|
| float offset = top_controls_height_ - residue;
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_FLOAT_EQ(-offset,
|
| host_impl_->top_controls_manager()->ControlsTopOffset());
|
| EXPECT_EQ(gfx::Vector2dF().ToString(),
|
| @@ -7665,8 +7818,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
|
| // Scroll the top controls partially.
|
| const float residue = 15;
|
| float offset = top_controls_height_ - residue;
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_FLOAT_EQ(-offset,
|
| host_impl_->top_controls_manager()->ControlsTopOffset());
|
| EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
|
| @@ -7729,8 +7882,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
|
| // Scroll the top controls partially.
|
| const float residue = 15;
|
| float offset = top_controls_height_ - residue;
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_FLOAT_EQ(-offset,
|
| host_impl_->top_controls_manager()->ControlsTopOffset());
|
| EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
|
| @@ -7787,19 +7940,19 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
|
| EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
|
|
|
| float offset = 50;
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset());
|
| EXPECT_EQ(gfx::Vector2dF().ToString(),
|
| scroll_layer->CurrentScrollOffset().ToString());
|
|
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(gfx::Vector2dF(0, offset).ToString(),
|
| scroll_layer->CurrentScrollOffset().ToString());
|
|
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
|
|
| // Should have fully scrolled
|
| EXPECT_EQ(gfx::Vector2dF(0, scroll_layer->MaxScrollOffset().y()).ToString(),
|
| @@ -7808,22 +7961,22 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
|
| float overscrollamount = 10;
|
|
|
| // Overscroll the content
|
| - EXPECT_FALSE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, overscrollamount))
|
| - .did_scroll);
|
| + EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(),
|
| + gfx::Vector2d(0, overscrollamount),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(gfx::Vector2dF(0, 2 * offset).ToString(),
|
| scroll_layer->CurrentScrollOffset().ToString());
|
| EXPECT_EQ(gfx::Vector2dF(0, overscrollamount).ToString(),
|
| host_impl_->accumulated_root_overscroll().ToString());
|
|
|
| - EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -2 * offset))
|
| - .did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -2 * offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(),
|
| scroll_layer->CurrentScrollOffset().ToString());
|
| EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset());
|
|
|
| - EXPECT_TRUE(
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -offset)).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -offset),
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(),
|
| scroll_layer->CurrentScrollOffset().ToString());
|
|
|
| @@ -7920,7 +8073,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) {
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
|
|
|
| gfx::Vector2d scroll_delta(inner_viewport.width(), inner_viewport.height());
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| outer_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
|
|
|
| host_impl_->ScrollEnd();
|
| @@ -7933,10 +8087,12 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) {
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
|
|
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| outer_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
|
|
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
|
|
|
| host_impl_->ScrollEnd();
|
| @@ -7970,7 +8126,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
|
|
|
| // Scroll near the edge of the outer viewport.
|
| gfx::Vector2d scroll_delta(inner_viewport.width(), inner_viewport.height());
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| outer_expected += scroll_delta;
|
|
|
| EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
|
| @@ -7979,7 +8136,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
|
| // Now diagonal scroll across the outer viewport boundary in a single event.
|
| // The entirety of the scroll should be consumed, as bubbling between inner
|
| // and outer viewport layers is perfect.
|
| - host_impl_->ScrollBy(gfx::Point(), gfx::ScaleVector2d(scroll_delta, 2));
|
| + host_impl_->ScrollBy(gfx::Point(), gfx::ScaleVector2d(scroll_delta, 2),
|
| + InputHandler::RAILS_MODE_FREE);
|
| outer_expected += scroll_delta;
|
| inner_expected += scroll_delta;
|
| host_impl_->ScrollEnd();
|
| @@ -8012,7 +8170,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
|
| gfx::Vector2d scroll_delta(0, inner_viewport.height());
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED,
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
|
| - EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
|
|
| // The child should have scrolled up to its limit.
|
| scroll_info = host_impl_->ProcessScrollDeltas();
|
| @@ -8023,7 +8182,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
|
| // The first |ScrollBy| after the fling should re-lock the scrolling
|
| // layer to the first layer that scrolled, the inner viewport scroll layer.
|
| EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
|
| - EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), inner_scroll);
|
|
|
| // The inner viewport should have scrolled up to its limit.
|
| @@ -8033,7 +8193,9 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
|
| ExpectContains(*scroll_info, inner_scroll->id(), scroll_delta);
|
|
|
| // As the locked layer is at its limit, no further scrolling can occur.
|
| - EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
|
| + EXPECT_FALSE(
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE).did_scroll);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), inner_scroll);
|
| host_impl_->ScrollEnd();
|
| }
|
| @@ -8475,7 +8637,8 @@ TEST_F(LayerTreeHostImplTest, WheelScrollWithPageScaleFactorOnInnerLayer) {
|
| host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset());
|
|
|
| - host_impl_->ScrollBy(gfx::Point(), scroll_delta);
|
| + host_impl_->ScrollBy(gfx::Point(), scroll_delta,
|
| + InputHandler::RAILS_MODE_FREE);
|
| host_impl_->ScrollEnd();
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 2.5),
|
| scroll_layer->CurrentScrollOffset());
|
|
|