| 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 7776f3a2b216179fcf99f5eee9a5331478657f1b..b69f3f945952876752bbc27a75e0a33434bed790 100644
|
| --- a/cc/trees/layer_tree_host_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc
|
| @@ -362,8 +362,8 @@ class LayerTreeHostImplTest : public testing::Test,
|
| }
|
|
|
| LayerImpl* SetupScrollAndContentsLayers(const gfx::Size& content_size) {
|
| - LayerImpl* scroll_layer = CreateScrollAndContentsLayers(
|
| - host_impl_->active_tree(), content_size);
|
| + LayerImpl* scroll_layer =
|
| + CreateScrollAndContentsLayers(host_impl_->active_tree(), content_size);
|
| host_impl_->active_tree()->DidBecomeActive();
|
| return scroll_layer;
|
| }
|
| @@ -748,10 +748,11 @@ TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) {
|
| DrawFrame();
|
|
|
| // We should not crash if the tree is replaced while we are scrolling.
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
| host_impl_->active_tree()->DetachLayers();
|
|
|
| scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
|
| @@ -780,9 +781,8 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnWheelEventHandlers) {
|
| host_impl_->GetEventListenerProperties(EventListenerClass::kMouseWheel));
|
|
|
| // But they don't influence the actual handling of the scroll gestures.
|
| - InputHandler::ScrollStatus status =
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL);
|
| + InputHandler::ScrollStatus status = host_impl_->ScrollBegin(
|
| + BeginState(gfx::Point()).get(), InputHandler::WHEEL);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
|
| EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
|
| status.main_thread_scrolling_reasons);
|
| @@ -1130,64 +1130,64 @@ TEST_F(LayerTreeHostImplTest, ScrollByReturnsCorrectValue) {
|
|
|
| // Trying to scroll to the left/top will not succeed.
|
| EXPECT_FALSE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(-10, 0)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(-10, 0)).get())
|
| .did_scroll);
|
| EXPECT_FALSE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, -10)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, -10)).get())
|
| .did_scroll);
|
| EXPECT_FALSE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(-10, -10)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(-10, -10)).get())
|
| .did_scroll);
|
|
|
| // Scrolling to the right/bottom will succeed.
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(10, 0)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(10, 0)).get())
|
| .did_scroll);
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get())
|
| .did_scroll);
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(10, 10)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(10, 10)).get())
|
| .did_scroll);
|
|
|
| // Scrolling to left/top will now succeed.
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(-10, 0)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(-10, 0)).get())
|
| .did_scroll);
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, -10)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, -10)).get())
|
| .did_scroll);
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(-10, -10)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(-10, -10)).get())
|
| .did_scroll);
|
|
|
| // Scrolling diagonally against an edge will succeed.
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(10, -10)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(10, -10)).get())
|
| .did_scroll);
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(-10, 0)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(-10, 0)).get())
|
| .did_scroll);
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(-10, 10)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(-10, 10)).get())
|
| .did_scroll);
|
|
|
| // Trying to scroll more than the available space will also succeed.
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(5000, 5000)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(5000, 5000)).get())
|
| .did_scroll);
|
| }
|
|
|
| @@ -1211,10 +1211,11 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
|
| DrawFrame();
|
| gfx::Point scroll_position(10, 10);
|
|
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(scroll_position).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(scroll_position).get(), InputHandler::WHEEL)
|
| + .thread);
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), overflow->CurrentScrollOffset());
|
|
|
| @@ -1229,10 +1230,11 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
|
|
|
| DrawFrame();
|
|
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(scroll_position).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(scroll_position).get(), InputHandler::WHEEL)
|
| + .thread);
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 10), overflow->CurrentScrollOffset());
|
|
|
| @@ -1245,10 +1247,11 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
|
| host_impl_->active_tree()->BuildPropertyTreesForTesting();
|
| DrawFrame();
|
|
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(scroll_position).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(scroll_position).get(), InputHandler::WHEEL)
|
| + .thread);
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0), scroll_layer->CurrentScrollOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset());
|
|
|
| @@ -1651,8 +1654,9 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
|
|
|
| gfx::Vector2d scroll_delta(0, 10);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::WHEEL)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| + InputHandler::WHEEL)
|
| .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
| @@ -1680,9 +1684,8 @@ TEST_F(LayerTreeHostImplTest, ViewportScrollOrder) {
|
| inner_scroll_layer->SetDrawsContent(true);
|
| host_impl_->active_tree()->BuildPropertyTreesForTesting();
|
|
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(500, 500),
|
| - outer_scroll_layer->MaxScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(500, 500),
|
| + outer_scroll_layer->MaxScrollOffset());
|
|
|
| host_impl_->ScrollBegin(BeginState(gfx::Point(250, 250)).get(),
|
| InputHandler::TOUCHSCREEN);
|
| @@ -1692,12 +1695,10 @@ TEST_F(LayerTreeHostImplTest, ViewportScrollOrder) {
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| // Sanity check - we're zoomed in, starting from the origin.
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(0, 0),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(0, 0),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0),
|
| + outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
|
|
| // Scroll down - only the inner viewport should scroll.
|
| host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
|
| @@ -1706,12 +1707,10 @@ TEST_F(LayerTreeHostImplTest, ViewportScrollOrder) {
|
| UpdateState(gfx::Point(0, 0), gfx::Vector2dF(100.f, 100.f)).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(50, 50),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(0, 0),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 50),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0),
|
| + outer_scroll_layer->CurrentScrollOffset());
|
|
|
| // Scroll down - outer viewport should start scrolling after the inner is at
|
| // its maximum.
|
| @@ -1721,12 +1720,10 @@ TEST_F(LayerTreeHostImplTest, ViewportScrollOrder) {
|
| UpdateState(gfx::Point(0, 0), gfx::Vector2dF(1000.f, 1000.f)).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(250, 250),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(300, 300),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(250, 250),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(300, 300),
|
| + outer_scroll_layer->CurrentScrollOffset());
|
| }
|
|
|
| // Make sure scrolls smaller than a unit applied to the viewport don't get
|
| @@ -1747,9 +1744,8 @@ TEST_F(LayerTreeHostImplTest, ScrollViewportWithFractionalAmounts) {
|
| host_impl_->active_tree()->BuildPropertyTreesForTesting();
|
|
|
| // Sanity checks.
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(500, 500),
|
| - outer_scroll_layer->MaxScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(500, 500),
|
| + outer_scroll_layer->MaxScrollOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), outer_scroll_layer->CurrentScrollOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), inner_scroll_layer->CurrentScrollOffset());
|
|
|
| @@ -1758,12 +1754,10 @@ TEST_F(LayerTreeHostImplTest, ScrollViewportWithFractionalAmounts) {
|
| InputHandler::TOUCHSCREEN);
|
| host_impl_->ScrollBy(
|
| UpdateState(gfx::Point(250, 250), gfx::Vector2dF(0.125f, 0.125f)).get());
|
| - EXPECT_VECTOR2DF_EQ(
|
| - gfx::Vector2dF(0.125f, 0.125f),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR2DF_EQ(
|
| - gfx::Vector2dF(0, 0),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR2DF_EQ(gfx::Vector2dF(0.125f, 0.125f),
|
| + outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR2DF_EQ(gfx::Vector2dF(0, 0),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| host_impl_->active_tree()->PushPageScaleFromMainThread(2.f, 1.f, 2.f);
|
| @@ -1773,12 +1767,10 @@ TEST_F(LayerTreeHostImplTest, ScrollViewportWithFractionalAmounts) {
|
| InputHandler::TOUCHSCREEN);
|
| host_impl_->ScrollBy(
|
| UpdateState(gfx::Point(250, 250), gfx::Vector2dF(0.5f, 0.5f)).get());
|
| - EXPECT_VECTOR2DF_EQ(
|
| - gfx::Vector2dF(0.125f, 0.125f),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR2DF_EQ(
|
| - gfx::Vector2dF(0.25f, 0.25f),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR2DF_EQ(gfx::Vector2dF(0.125f, 0.125f),
|
| + outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR2DF_EQ(gfx::Vector2dF(0.25f, 0.25f),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
| host_impl_->ScrollEnd(EndState().get());
|
| }
|
|
|
| @@ -1800,44 +1792,37 @@ TEST_F(LayerTreeHostImplTest, ScrollDuringPinchGesture) {
|
| inner_scroll_layer->SetDrawsContent(true);
|
| host_impl_->active_tree()->BuildPropertyTreesForTesting();
|
|
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(500, 500),
|
| - outer_scroll_layer->MaxScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(500, 500),
|
| + outer_scroll_layer->MaxScrollOffset());
|
|
|
| host_impl_->ScrollBegin(BeginState(gfx::Point(250, 250)).get(),
|
| InputHandler::TOUCHSCREEN);
|
| host_impl_->PinchGestureBegin();
|
|
|
| host_impl_->PinchGestureUpdate(2, gfx::Point(250, 250));
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(0, 0),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(125, 125),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0),
|
| + outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(125, 125),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
|
|
| // Needed so that the pinch is accounted for in draw properties.
|
| DrawFrame();
|
|
|
| host_impl_->ScrollBy(
|
| UpdateState(gfx::Point(250, 250), gfx::Vector2dF(10.f, 10.f)).get());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(0, 0),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(130, 130),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0),
|
| + outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(130, 130),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
|
|
| DrawFrame();
|
|
|
| host_impl_->ScrollBy(
|
| UpdateState(gfx::Point(250, 250), gfx::Vector2dF(400.f, 400.f)).get());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(80, 80),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(250, 250),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(80, 80),
|
| + outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(250, 250),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
|
|
| host_impl_->PinchGestureEnd();
|
| host_impl_->ScrollEnd(EndState().get());
|
| @@ -1950,12 +1935,9 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoomWheelBubbleBetweenViewports) {
|
| UpdateState(gfx::Point(0, 0), gfx::Vector2dF(10.f, 20.f)).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(5, 10),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(5, 10),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(), outer_scroll_layer->CurrentScrollOffset());
|
|
|
| // Scroll by the inner viewport's max scroll extent, the remainder
|
| // should bubble up to the outer viewport.
|
| @@ -1965,12 +1947,10 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoomWheelBubbleBetweenViewports) {
|
| UpdateState(gfx::Point(0, 0), gfx::Vector2dF(100.f, 100.f)).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(50, 50),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(5, 10),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 50),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(5, 10),
|
| + outer_scroll_layer->CurrentScrollOffset());
|
|
|
| // Scroll by the outer viewport's max scroll extent, it should all go to the
|
| // outer viewport.
|
| @@ -1980,12 +1960,10 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoomWheelBubbleBetweenViewports) {
|
| UpdateState(gfx::Point(0, 0), gfx::Vector2dF(190.f, 180.f)).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(100, 100),
|
| - outer_scroll_layer->CurrentScrollOffset());
|
| - EXPECT_VECTOR_EQ(
|
| - gfx::Vector2dF(50, 50),
|
| - inner_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(100, 100),
|
| + outer_scroll_layer->CurrentScrollOffset());
|
| + EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 50),
|
| + inner_scroll_layer->CurrentScrollOffset());
|
| }
|
|
|
| TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) {
|
| @@ -2021,9 +1999,9 @@ TEST_F(LayerTreeHostImplTest, ScrollDoesntBubble) {
|
|
|
| // Set up two scrolling children of the root, one of which is a scroll parent
|
| // to the other. Scrolls shouldn't bubbling from the child.
|
| - LayerImpl *parent;
|
| - LayerImpl *child;
|
| - LayerImpl *child_clip;
|
| + LayerImpl* parent;
|
| + LayerImpl* child;
|
| + LayerImpl* child_clip;
|
|
|
| std::unique_ptr<LayerImpl> scroll_parent_clip =
|
| LayerImpl::Create(host_impl_->active_tree(), 6);
|
| @@ -2104,7 +2082,6 @@ TEST_F(LayerTreeHostImplTest, ScrollDoesntBubble) {
|
| }
|
| }
|
|
|
| -
|
| TEST_F(LayerTreeHostImplTest, PinchGesture) {
|
| SetupScrollAndContentsLayers(gfx::Size(100, 100));
|
| host_impl_->SetViewportSize(gfx::Size(50, 50));
|
| @@ -2336,8 +2313,8 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) {
|
|
|
| float min_page_scale = 0.5f;
|
| float max_page_scale = 4.f;
|
| - base::TimeTicks start_time = base::TimeTicks() +
|
| - base::TimeDelta::FromSeconds(1);
|
| + base::TimeTicks start_time =
|
| + base::TimeTicks() + base::TimeDelta::FromSeconds(1);
|
| base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100);
|
| base::TimeTicks halfway_through_animation = start_time + duration / 2;
|
| base::TimeTicks end_time = start_time + duration;
|
| @@ -2461,8 +2438,8 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationNoOp) {
|
|
|
| float min_page_scale = 0.5f;
|
| float max_page_scale = 4.f;
|
| - base::TimeTicks start_time = base::TimeTicks() +
|
| - base::TimeDelta::FromSeconds(1);
|
| + base::TimeTicks start_time =
|
| + base::TimeTicks() + base::TimeDelta::FromSeconds(1);
|
| base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100);
|
| base::TimeTicks halfway_through_animation = start_time + duration / 2;
|
| base::TimeTicks end_time = start_time + duration;
|
| @@ -2511,9 +2488,8 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationNoOp) {
|
| TEST_F(LayerTreeHostImplTest, PageScaleAnimationTransferedOnSyncTreeActivate) {
|
| host_impl_->CreatePendingTree();
|
| host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
|
| - CreateScrollAndContentsLayers(
|
| - host_impl_->pending_tree(),
|
| - gfx::Size(100, 100));
|
| + CreateScrollAndContentsLayers(host_impl_->pending_tree(),
|
| + gfx::Size(100, 100));
|
| host_impl_->pending_tree()->BuildPropertyTreesForTesting();
|
| host_impl_->ActivateSyncTree();
|
| DrawFrame();
|
| @@ -2527,8 +2503,8 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationTransferedOnSyncTreeActivate) {
|
| max_page_scale);
|
| host_impl_->ActivateSyncTree();
|
|
|
| - base::TimeTicks start_time = base::TimeTicks() +
|
| - base::TimeDelta::FromSeconds(1);
|
| + base::TimeTicks start_time =
|
| + base::TimeTicks() + base::TimeDelta::FromSeconds(1);
|
| base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100);
|
| base::TimeTicks third_through_animation = start_time + duration / 3;
|
| base::TimeTicks halfway_through_animation = start_time + duration / 2;
|
| @@ -2572,7 +2548,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationTransferedOnSyncTreeActivate) {
|
| // It should also clear the pointer on the sync tree.
|
| host_impl_->ActivateSyncTree();
|
| EXPECT_EQ(nullptr,
|
| - host_impl_->sync_tree()->TakePendingPageScaleAnimation().get());
|
| + host_impl_->sync_tree()->TakePendingPageScaleAnimation().get());
|
| EXPECT_FALSE(did_request_redraw_);
|
| EXPECT_TRUE(did_request_next_frame_);
|
|
|
| @@ -2997,7 +2973,7 @@ class LayerTreeHostImplTestScrollbarOpacity : public LayerTreeHostImplTest {
|
|
|
| if (expecting_animations) {
|
| host_impl_->ScrollbarAnimationControllerForId(scroll->id())
|
| - ->DidMouseMoveNear(0);
|
| + ->DidMouseMoveNear(VERTICAL, 0);
|
| } else {
|
| EXPECT_EQ(nullptr,
|
| host_impl_->ScrollbarAnimationControllerForId(scroll->id()));
|
| @@ -3257,26 +3233,34 @@ void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale(
|
| scrollbar_animation_controller->set_mouse_move_distance_for_test(100.f);
|
|
|
| host_impl_->MouseMoveAt(gfx::Point(200, 1));
|
| - EXPECT_FALSE(scrollbar_animation_controller->mouse_is_near_scrollbar());
|
| + EXPECT_FALSE(
|
| + scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
|
|
| host_impl_->MouseMoveAt(gfx::Point(100, 50));
|
| - EXPECT_TRUE(scrollbar_animation_controller->mouse_is_near_scrollbar());
|
| + EXPECT_TRUE(
|
| + scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
|
|
| host_impl_->MouseMoveAt(gfx::Point(116, 100));
|
| - EXPECT_FALSE(scrollbar_animation_controller->mouse_is_near_scrollbar());
|
| + EXPECT_FALSE(
|
| + scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
|
|
| scrollbar_animation_controller->set_mouse_move_distance_for_test(102.f);
|
| host_impl_->MouseMoveAt(gfx::Point(116, 100));
|
| - EXPECT_TRUE(scrollbar_animation_controller->mouse_is_near_scrollbar());
|
| + EXPECT_TRUE(
|
| + scrollbar_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
|
|
| did_request_redraw_ = false;
|
| - EXPECT_FALSE(scrollbar_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_FALSE(
|
| + scrollbar_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| host_impl_->MouseMoveAt(gfx::Point(10, 100));
|
| - EXPECT_TRUE(scrollbar_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_TRUE(
|
| + scrollbar_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| host_impl_->MouseMoveAt(gfx::Point(10, 120));
|
| - EXPECT_TRUE(scrollbar_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_TRUE(
|
| + scrollbar_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| host_impl_->MouseMoveAt(gfx::Point(150, 120));
|
| - EXPECT_FALSE(scrollbar_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_FALSE(
|
| + scrollbar_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| }
|
|
|
| TEST_F(LayerTreeHostImplTest, MouseMoveAtWithDeviceScaleOf1) {
|
| @@ -3306,10 +3290,11 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) {
|
| }
|
|
|
| // Scrolling should update metadata immediately.
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
|
| {
|
| CompositorFrameMetadata metadata =
|
| @@ -4591,8 +4576,7 @@ TEST_F(LayerTreeHostImplBrowserControlsTest,
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| // The viewport offset shouldn't have changed.
|
| - EXPECT_EQ(viewport_offset,
|
| - host_impl_->active_tree()->TotalScrollOffset());
|
| + EXPECT_EQ(viewport_offset, host_impl_->active_tree()->TotalScrollOffset());
|
|
|
| // Scroll the viewports to max scroll offset.
|
| SetScrollOffsetDelta(outer_scroll, gfx::Vector2dF(0, 200.f));
|
| @@ -4629,9 +4613,9 @@ TEST_F(LayerTreeHostImplBrowserControlsTest, BrowserControlsAspectRatio) {
|
| // Browser controls were hidden by 25px so the inner viewport should have
|
| // expanded by that much.
|
| LayerImpl* outer_container =
|
| - host_impl_->active_tree()->OuterViewportContainerLayer();
|
| + host_impl_->active_tree()->OuterViewportContainerLayer();
|
| LayerImpl* inner_container =
|
| - host_impl_->active_tree()->InnerViewportContainerLayer();
|
| + host_impl_->active_tree()->InnerViewportContainerLayer();
|
| EXPECT_EQ(gfx::SizeF(100.f, 100.f + 25.f),
|
| inner_container->BoundsForScrolling());
|
|
|
| @@ -4914,10 +4898,11 @@ TEST_F(LayerTreeHostImplTest, ScrollNonCompositedRoot) {
|
| host_impl_->SetViewportSize(surface_size);
|
| DrawFrame();
|
|
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(), InputHandler::WHEEL)
|
| + .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
| EXPECT_TRUE(did_request_redraw_);
|
| @@ -4939,10 +4924,11 @@ TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) {
|
| host_impl_->SetViewportSize(surface_size);
|
| DrawFrame();
|
|
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(), InputHandler::WHEEL)
|
| + .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
| EXPECT_TRUE(did_request_redraw_);
|
| @@ -5064,10 +5050,11 @@ TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnMainThread) {
|
| gfx::Vector2d scroll_delta(0, 10);
|
| gfx::Vector2d expected_scroll_delta = scroll_delta;
|
| gfx::ScrollOffset expected_max_scroll = root_scroll->MaxScrollOffset();
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(), InputHandler::WHEEL)
|
| + .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| @@ -5114,10 +5101,11 @@ TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnImplThread) {
|
| gfx::Vector2d scroll_delta(0, 10);
|
| gfx::Vector2d expected_scroll_delta = scroll_delta;
|
| gfx::ScrollOffset expected_max_scroll = root_scroll->MaxScrollOffset();
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(), InputHandler::WHEEL)
|
| + .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| @@ -5216,10 +5204,11 @@ TEST_F(LayerTreeHostImplTest, ScrollChildAndChangePageScaleOnMainThread) {
|
| gfx::Vector2d scroll_delta(0, 10);
|
| gfx::Vector2d expected_scroll_delta(scroll_delta);
|
| gfx::ScrollOffset expected_max_scroll(outer_scroll->MaxScrollOffset());
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(), InputHandler::WHEEL)
|
| + .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| @@ -5279,10 +5268,11 @@ TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) {
|
| DrawFrame();
|
| {
|
| gfx::Vector2d scroll_delta(-8, -7);
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| @@ -5350,8 +5340,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
|
| {
|
| gfx::Vector2d scroll_delta(0, -10);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::NON_BUBBLING_GESTURE)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(),
|
| + InputHandler::NON_BUBBLING_GESTURE)
|
| .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
| @@ -5378,8 +5369,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
|
| // The next time we scroll we should only scroll the parent.
|
| scroll_delta = gfx::Vector2d(0, -3);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::NON_BUBBLING_GESTURE)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| + InputHandler::NON_BUBBLING_GESTURE)
|
| .thread);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| @@ -5400,8 +5392,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
|
| // should still scroll the child.
|
| scroll_delta = gfx::Vector2d(0, 7);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::NON_BUBBLING_GESTURE)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| + InputHandler::NON_BUBBLING_GESTURE)
|
| .thread);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| @@ -5424,8 +5417,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
|
|
|
| scroll_delta = gfx::Vector2d(0, -2);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(1, 1)).get(),
|
| - InputHandler::NON_BUBBLING_GESTURE)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(1, 1)).get(),
|
| + InputHandler::NON_BUBBLING_GESTURE)
|
| .thread);
|
| EXPECT_EQ(grand_child, host_impl_->CurrentlyScrollingLayer());
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| @@ -5473,8 +5467,9 @@ TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) {
|
| {
|
| gfx::Vector2d scroll_delta(0, 4);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::WHEEL)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| + InputHandler::WHEEL)
|
| .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
| @@ -5549,10 +5544,11 @@ TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) {
|
| host_impl_->active_tree()->DidBecomeActive();
|
|
|
| // Scrolling should still work even though we did not draw yet.
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(), InputHandler::WHEEL)
|
| + .thread);
|
| }
|
|
|
| TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
|
| @@ -5591,10 +5587,11 @@ TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
|
| // Reset and scroll down with the wheel.
|
| SetScrollOffsetDelta(scroll_layer, gfx::Vector2dF());
|
| gfx::Vector2d wheel_scroll_delta(0, 10);
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), wheel_scroll_delta).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| @@ -5769,8 +5766,7 @@ TEST_F(LayerTreeHostImplTest, ScrollPerspectiveTransformedLayer) {
|
| }
|
|
|
| TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) {
|
| - LayerImpl* scroll_layer =
|
| - SetupScrollAndContentsLayers(gfx::Size(100, 100));
|
| + LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
|
|
|
| // Scale the layer to twice its normal size.
|
| int scale = 2;
|
| @@ -5804,10 +5800,11 @@ TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) {
|
| // Reset and scroll down with the wheel.
|
| SetScrollOffsetDelta(scroll_layer, gfx::Vector2dF());
|
| gfx::Vector2d wheel_scroll_delta(0, 10);
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), wheel_scroll_delta).get());
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| @@ -5866,29 +5863,17 @@ class TestInputHandlerClient : public InputHandlerClient {
|
| }
|
| void DeliverInputForBeginFrame() override {}
|
|
|
| - gfx::ScrollOffset last_set_scroll_offset() {
|
| - return last_set_scroll_offset_;
|
| - }
|
| + gfx::ScrollOffset last_set_scroll_offset() { return last_set_scroll_offset_; }
|
|
|
| - gfx::ScrollOffset max_scroll_offset() const {
|
| - return max_scroll_offset_;
|
| - }
|
| + gfx::ScrollOffset max_scroll_offset() const { return max_scroll_offset_; }
|
|
|
| - gfx::SizeF scrollable_size() const {
|
| - return scrollable_size_;
|
| - }
|
| + gfx::SizeF scrollable_size() const { return scrollable_size_; }
|
|
|
| - float page_scale_factor() const {
|
| - return page_scale_factor_;
|
| - }
|
| + float page_scale_factor() const { return page_scale_factor_; }
|
|
|
| - float min_page_scale_factor() const {
|
| - return min_page_scale_factor_;
|
| - }
|
| + float min_page_scale_factor() const { return min_page_scale_factor_; }
|
|
|
| - float max_page_scale_factor() const {
|
| - return max_page_scale_factor_;
|
| - }
|
| + float max_page_scale_factor() const { return max_page_scale_factor_; }
|
|
|
| private:
|
| gfx::ScrollOffset last_set_scroll_offset_;
|
| @@ -6050,10 +6035,11 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
|
| EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
|
|
|
| // In-bounds scrolling does not affect overscroll.
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
| scroll_result = host_impl_->ScrollBy(
|
| UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
|
| EXPECT_TRUE(scroll_result.did_scroll);
|
| @@ -6212,8 +6198,9 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
|
| {
|
| gfx::Vector2d scroll_delta(0, -10);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::NON_BUBBLING_GESTURE)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(),
|
| + InputHandler::NON_BUBBLING_GESTURE)
|
| .thread);
|
| scroll_result =
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| @@ -6226,8 +6213,9 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
|
| // should still not reach the root layer.
|
| scroll_delta = gfx::Vector2d(0, -30);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::NON_BUBBLING_GESTURE)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| + InputHandler::NON_BUBBLING_GESTURE)
|
| .thread);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
|
| EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
|
| @@ -6249,8 +6237,9 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
|
| // should scroll the child.
|
| scroll_delta = gfx::Vector2d(0, 70);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::NON_BUBBLING_GESTURE)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| + InputHandler::NON_BUBBLING_GESTURE)
|
| .thread);
|
| EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
|
| scroll_result =
|
| @@ -6275,8 +6264,9 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildEventBubbling) {
|
| {
|
| gfx::Vector2d scroll_delta(0, 8);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| - InputHandler::WHEEL)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
|
| + InputHandler::WHEEL)
|
| .thread);
|
| scroll_result =
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| @@ -6315,10 +6305,11 @@ TEST_F(LayerTreeHostImplTest, OverscrollAlways) {
|
| EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
|
|
|
| // Even though the layer can't scroll the overscroll still happens.
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
| scroll_result = host_impl_->ScrollBy(
|
| UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
|
| EXPECT_FALSE(scroll_result.did_scroll);
|
| @@ -6343,8 +6334,9 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
|
| // of the content. unnecessary glow effect calls shouldn't be
|
| // called while scrolling up without reaching the edge of the content.
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
|
| - InputHandler::WHEEL)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
|
| + InputHandler::WHEEL)
|
| .thread);
|
| scroll_result = host_impl_->ScrollBy(
|
| UpdateState(gfx::Point(), gfx::Vector2dF(0, 100)).get());
|
| @@ -6362,8 +6354,9 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
|
| // unusedrootDelta should be subtracted from applied delta so that
|
| // unwanted glow effect calls are not called.
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
|
| - InputHandler::NON_BUBBLING_GESTURE)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
|
| + InputHandler::NON_BUBBLING_GESTURE)
|
| .thread);
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| host_impl_->FlingScrollBegin().thread);
|
| @@ -6384,8 +6377,9 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
|
| // TestCase to check kEpsilon, which prevents minute values to trigger
|
| // gloweffect without reaching edge.
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
|
| - InputHandler::WHEEL)
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
|
| + InputHandler::WHEEL)
|
| .thread);
|
| scroll_result = host_impl_->ScrollBy(
|
| UpdateState(gfx::Point(), gfx::Vector2dF(-0.12f, 0.1f)).get());
|
| @@ -6898,15 +6892,10 @@ class BlendStateCheckLayer : public LayerImpl {
|
|
|
| TileDrawQuad* test_blending_draw_quad =
|
| render_pass->CreateAndAppendDrawQuad<TileDrawQuad>();
|
| - test_blending_draw_quad->SetNew(shared_quad_state,
|
| - quad_rect_,
|
| - opaque_rect,
|
| - visible_quad_rect,
|
| - resource_id_,
|
| + test_blending_draw_quad->SetNew(shared_quad_state, quad_rect_, opaque_rect,
|
| + visible_quad_rect, resource_id_,
|
| gfx::RectF(0.f, 0.f, 1.f, 1.f),
|
| - gfx::Size(1, 1),
|
| - false,
|
| - false);
|
| + gfx::Size(1, 1), false, false);
|
| test_blending_draw_quad->visible_rect = quad_visible_rect_;
|
| EXPECT_EQ(blend_, test_blending_draw_quad->ShouldDrawWithBlending());
|
| EXPECT_EQ(has_render_surface_, !!render_surface());
|
| @@ -7254,10 +7243,10 @@ TEST_F(LayerTreeHostImplTest, MayContainVideo) {
|
|
|
| class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
|
| protected:
|
| - LayerTreeHostImplViewportCoveredTest() :
|
| - gutter_quad_material_(DrawQuad::SOLID_COLOR),
|
| - child_(NULL),
|
| - did_activate_pending_tree_(false) {}
|
| + LayerTreeHostImplViewportCoveredTest()
|
| + : gutter_quad_material_(DrawQuad::SOLID_COLOR),
|
| + child_(NULL),
|
| + did_activate_pending_tree_(false) {}
|
|
|
| std::unique_ptr<CompositorFrameSink> CreateFakeCompositorFrameSink(
|
| bool software) {
|
| @@ -7548,11 +7537,12 @@ TEST_F(LayerTreeHostImplViewportCoveredTest, ActiveTreeShrinkViewportInvalid) {
|
| EXPECT_SCOPED(TestLayerIsLargerThanViewportWithOnDraw());
|
| }
|
|
|
| -class FakeDrawableLayerImpl: public LayerImpl {
|
| +class FakeDrawableLayerImpl : public LayerImpl {
|
| public:
|
| static std::unique_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
|
| return base::WrapUnique(new FakeDrawableLayerImpl(tree_impl, id));
|
| }
|
| +
|
| protected:
|
| FakeDrawableLayerImpl(LayerTreeImpl* tree_impl, int id)
|
| : LayerImpl(tree_impl, id) {}
|
| @@ -7687,8 +7677,8 @@ class FakeLayerWithQuads : public LayerImpl {
|
| gfx::Rect visible_quad_rect(quad_rect);
|
| SolidColorDrawQuad* my_quad =
|
| render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
|
| - my_quad->SetNew(
|
| - shared_quad_state, quad_rect, visible_quad_rect, gray, false);
|
| + my_quad->SetNew(shared_quad_state, quad_rect, visible_quad_rect, gray,
|
| + false);
|
| }
|
|
|
| private:
|
| @@ -7841,9 +7831,8 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
|
| root_layer->SetBounds(gfx::Size(10, 10));
|
| root_layer->test_properties()->force_render_surface = true;
|
|
|
| - scoped_refptr<VideoFrame> softwareFrame =
|
| - media::VideoFrame::CreateColorFrame(
|
| - gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta());
|
| + scoped_refptr<VideoFrame> softwareFrame = media::VideoFrame::CreateColorFrame(
|
| + gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta());
|
| FakeVideoFrameProvider provider;
|
| provider.set_frame(softwareFrame);
|
| std::unique_ptr<VideoLayerImpl> video_layer = VideoLayerImpl::Create(
|
| @@ -7873,10 +7862,8 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
|
| class MockDrawQuadsToFillScreenContext : public TestWebGraphicsContext3D {
|
| public:
|
| MOCK_METHOD1(useProgram, void(GLuint program));
|
| - MOCK_METHOD4(drawElements, void(GLenum mode,
|
| - GLsizei count,
|
| - GLenum type,
|
| - GLintptr offset));
|
| + MOCK_METHOD4(drawElements,
|
| + void(GLenum mode, GLsizei count, GLenum type, GLintptr offset));
|
| };
|
|
|
| TEST_F(LayerTreeHostImplTest, HasTransparentBackground) {
|
| @@ -8612,10 +8599,11 @@ TEST_F(LayerTreeHostImplTest, WheelFlingShouldntBubble) {
|
| host_impl_->SetViewportSize(surface_size);
|
| DrawFrame();
|
| {
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
|
|
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| host_impl_->FlingScrollBegin().thread);
|
| @@ -8735,10 +8723,11 @@ TEST_F(LayerTreeHostImplTest, ScrollInvisibleScroller) {
|
|
|
| // We should have scrolled |child_scroll| even though it does not move
|
| // any layer that is a drawn RSLL member.
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
|
|
| EXPECT_EQ(7, host_impl_->CurrentlyScrollingLayer()->id());
|
| }
|
| @@ -8761,8 +8750,8 @@ TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
|
| host_impl_->compositor_frame_sink());
|
|
|
| ui::LatencyInfo latency_info;
|
| - latency_info.AddLatencyNumber(
|
| - ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, 0);
|
| + latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0,
|
| + 0);
|
| std::unique_ptr<SwapPromise> swap_promise(
|
| new LatencyInfoSwapPromise(latency_info));
|
| host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise));
|
| @@ -8925,8 +8914,8 @@ TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) {
|
| InputHandler::TOUCHSCREEN)
|
| .thread);
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get())
|
| .did_scroll);
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| @@ -8943,8 +8932,8 @@ TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) {
|
| InputHandler::TOUCHSCREEN)
|
| .thread);
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get())
|
| .did_scroll);
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| @@ -9110,10 +9099,11 @@ TEST_F(LayerTreeHostImplWithBrowserControlsTest,
|
|
|
| LayerImpl* viewport_layer = host_impl_->InnerViewportScrollLayer();
|
|
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
| EXPECT_EQ(0, host_impl_->browser_controls_manager()->ControlsTopOffset());
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), viewport_layer->CurrentScrollOffset());
|
|
|
| @@ -9121,8 +9111,8 @@ TEST_F(LayerTreeHostImplWithBrowserControlsTest,
|
| // directly through to the viewport.
|
| const float delta = top_controls_height_;
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, delta)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, delta)).get())
|
| .did_scroll);
|
| EXPECT_FLOAT_EQ(0,
|
| host_impl_->browser_controls_manager()->ControlsTopOffset());
|
| @@ -9130,8 +9120,8 @@ TEST_F(LayerTreeHostImplWithBrowserControlsTest,
|
| viewport_layer->CurrentScrollOffset());
|
|
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, delta)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, delta)).get())
|
| .did_scroll);
|
| EXPECT_FLOAT_EQ(0,
|
| host_impl_->browser_controls_manager()->ControlsTopOffset());
|
| @@ -9162,8 +9152,8 @@ TEST_F(LayerTreeHostImplWithBrowserControlsTest,
|
| const float residue = 35;
|
| float offset = top_controls_height_ - residue;
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| .did_scroll);
|
| EXPECT_FLOAT_EQ(-offset,
|
| host_impl_->browser_controls_manager()->ControlsTopOffset());
|
| @@ -9246,8 +9236,8 @@ TEST_F(LayerTreeHostImplWithBrowserControlsTest,
|
| const float residue = 15;
|
| float offset = top_controls_height_ - residue;
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| .did_scroll);
|
| EXPECT_FLOAT_EQ(-offset,
|
| host_impl_->browser_controls_manager()->ControlsTopOffset());
|
| @@ -9322,8 +9312,8 @@ TEST_F(LayerTreeHostImplWithBrowserControlsTest,
|
| const float residue = 15;
|
| float offset = top_controls_height_ - residue;
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| .did_scroll);
|
| EXPECT_FLOAT_EQ(-offset,
|
| host_impl_->browser_controls_manager()->ControlsTopOffset());
|
| @@ -9391,8 +9381,8 @@ TEST_F(LayerTreeHostImplWithBrowserControlsTest,
|
|
|
| float offset = 50;
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| .did_scroll);
|
| EXPECT_EQ(-offset,
|
| host_impl_->browser_controls_manager()->ControlsTopOffset());
|
| @@ -9400,15 +9390,15 @@ TEST_F(LayerTreeHostImplWithBrowserControlsTest,
|
| scroll_layer->CurrentScrollOffset().ToString());
|
|
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| .did_scroll);
|
| EXPECT_EQ(gfx::Vector2dF(0, offset).ToString(),
|
| scroll_layer->CurrentScrollOffset().ToString());
|
|
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
|
| .did_scroll);
|
|
|
| // Should have fully scrolled
|
| @@ -9418,28 +9408,29 @@ TEST_F(LayerTreeHostImplWithBrowserControlsTest,
|
| float overscrollamount = 10;
|
|
|
| // Overscroll the content
|
| - EXPECT_FALSE(
|
| - host_impl_->ScrollBy(UpdateState(gfx::Point(),
|
| - gfx::Vector2d(0, overscrollamount))
|
| - .get())
|
| - .did_scroll);
|
| + EXPECT_FALSE(host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(),
|
| + gfx::Vector2d(0, overscrollamount))
|
| + .get())
|
| + .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(UpdateState(gfx::Point(),
|
| - gfx::Vector2d(0, -2 * offset))
|
| - .get())
|
| - .did_scroll);
|
| + EXPECT_TRUE(
|
| + host_impl_
|
| + ->ScrollBy(
|
| + UpdateState(gfx::Point(), gfx::Vector2d(0, -2 * offset)).get())
|
| + .did_scroll);
|
| EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(),
|
| scroll_layer->CurrentScrollOffset().ToString());
|
| EXPECT_EQ(-offset,
|
| host_impl_->browser_controls_manager()->ControlsTopOffset());
|
|
|
| EXPECT_TRUE(
|
| - host_impl_->ScrollBy(
|
| - UpdateState(gfx::Point(), gfx::Vector2d(0, -offset)).get())
|
| + host_impl_
|
| + ->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, -offset)).get())
|
| .did_scroll);
|
| EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(),
|
| scroll_layer->CurrentScrollOffset().ToString());
|
| @@ -10505,10 +10496,11 @@ TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimatedAborted) {
|
| EXPECT_TRUE(y > 1 && y < 49);
|
|
|
| // Perform instant scroll.
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point(0, y)).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point(0, y)).get(), InputHandler::WHEEL)
|
| + .thread);
|
| EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y),
|
| InputHandler::WHEEL));
|
| host_impl_->ScrollBy(
|
| @@ -11016,10 +11008,11 @@ TEST_F(LayerTreeHostImplTest, WheelScrollWithPageScaleFactorOnInnerLayer) {
|
| host_impl_->ScrollEnd(EndState().get());
|
|
|
| gfx::Vector2dF scroll_delta(0, 5);
|
| - EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
|
| - host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
|
| - InputHandler::WHEEL)
|
| - .thread);
|
| + EXPECT_EQ(
|
| + InputHandler::SCROLL_ON_IMPL_THREAD,
|
| + host_impl_
|
| + ->ScrollBegin(BeginState(gfx::Point()).get(), InputHandler::WHEEL)
|
| + .thread);
|
| EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset());
|
|
|
| host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
|
| @@ -11675,20 +11668,30 @@ TEST_F(LayerTreeHostImplTest, LayerTreeHostImplTestScrollbarStates) {
|
| // Mouse moves close to the scrollbar, goes over the scrollbar, and
|
| // moves back to where it was.
|
| host_impl_->MouseMoveAt(gfx::Point(100, 150));
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| host_impl_->MouseMoveAt(gfx::Point(40, 150));
|
| - EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_TRUE(
|
| + scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| host_impl_->MouseMoveAt(gfx::Point(10, 150));
|
| - EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_TRUE(
|
| + scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_TRUE(
|
| + scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| host_impl_->MouseMoveAt(gfx::Point(40, 150));
|
| - EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_TRUE(
|
| + scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| host_impl_->MouseMoveAt(gfx::Point(100, 150));
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
|
|
| // scrollbar_2 on child.
|
| std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_2 =
|
| @@ -11724,25 +11727,41 @@ TEST_F(LayerTreeHostImplTest, LayerTreeHostImplTestScrollbarStates) {
|
| // Mouse goes over scrollbar_2, moves close to scrollbar_2, moves close to
|
| // scrollbar_1, goes over scrollbar_1.
|
| host_impl_->MouseMoveAt(gfx::Point(60, 150));
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
|
| - EXPECT_TRUE(scrollbar_2_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_TRUE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| + EXPECT_TRUE(
|
| + scrollbar_2_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_TRUE(
|
| + scrollbar_2_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| host_impl_->MouseMoveAt(gfx::Point(100, 150));
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
|
| - EXPECT_TRUE(scrollbar_2_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| + EXPECT_TRUE(
|
| + scrollbar_2_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_2_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| host_impl_->MouseMoveAt(gfx::Point(40, 150));
|
| - EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_FALSE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
|
| - EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_TRUE(
|
| + scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_2_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_2_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| host_impl_->MouseMoveAt(gfx::Point(10, 150));
|
| - EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_TRUE(scrollbar_1_animation_controller->mouse_is_over_scrollbar());
|
| - EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_near_scrollbar());
|
| - EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
|
| + EXPECT_TRUE(
|
| + scrollbar_1_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_TRUE(
|
| + scrollbar_1_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_2_animation_controller->mouse_is_near_scrollbar(VERTICAL));
|
| + EXPECT_FALSE(
|
| + scrollbar_2_animation_controller->mouse_is_over_scrollbar(VERTICAL));
|
| }
|
|
|
| } // namespace
|
|
|