| 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 934946bca89aa2803c624287f694b64494e4f3a9..3ef94459ca8c750d7007d3a51f0f90e5b9e29cb1 100644
|
| --- a/cc/trees/layer_tree_host_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc
|
| @@ -5373,7 +5373,7 @@ class LayerTreeHostImplTestWithDelegatingRenderer
|
|
|
| // Verify the damage rect for the root render pass.
|
| const RenderPass* root_render_pass = frame.render_passes.back();
|
| - EXPECT_RECT_EQ(expected_damage, root_render_pass->damage_rect);
|
| + EXPECT_EQ(expected_damage, root_render_pass->damage_rect);
|
|
|
| // Verify the root and child layers' quads are generated and not being
|
| // culled.
|
| @@ -5381,13 +5381,13 @@ class LayerTreeHostImplTestWithDelegatingRenderer
|
|
|
| LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0];
|
| gfx::RectF expected_child_visible_rect(child->content_bounds());
|
| - EXPECT_RECT_EQ(expected_child_visible_rect,
|
| - root_render_pass->quad_list.front()->visible_rect);
|
| + EXPECT_EQ(expected_child_visible_rect,
|
| + root_render_pass->quad_list.front()->visible_rect);
|
|
|
| LayerImpl* root = host_impl_->active_tree()->root_layer();
|
| gfx::RectF expected_root_visible_rect(root->content_bounds());
|
| - EXPECT_RECT_EQ(expected_root_visible_rect,
|
| - root_render_pass->quad_list.ElementAt(1)->visible_rect);
|
| + EXPECT_EQ(expected_root_visible_rect,
|
| + root_render_pass->quad_list.ElementAt(1)->visible_rect);
|
| }
|
|
|
| host_impl_->DrawLayers(&frame, gfx::FrameTime::Now());
|
| @@ -7621,6 +7621,56 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
|
| }
|
| }
|
|
|
| +TEST_F(LayerTreeHostImplVirtualViewportTest,
|
| + TouchFlingCanLockToViewportLayerAfterBubbling) {
|
| + gfx::Size content_size = gfx::Size(100, 160);
|
| + gfx::Size outer_viewport = gfx::Size(50, 80);
|
| + gfx::Size inner_viewport = gfx::Size(25, 40);
|
| +
|
| + SetupVirtualViewportLayers(content_size, outer_viewport, inner_viewport);
|
| +
|
| + LayerImpl* outer_scroll = host_impl_->OuterViewportScrollLayer();
|
| + LayerImpl* inner_scroll = host_impl_->InnerViewportScrollLayer();
|
| +
|
| + scoped_ptr<LayerImpl> child =
|
| + CreateScrollableLayer(10, outer_viewport, outer_scroll);
|
| + LayerImpl* child_scroll = child.get();
|
| + outer_scroll->children()[0]->AddChild(child.Pass());
|
| +
|
| + DrawFrame();
|
| + {
|
| + scoped_ptr<ScrollAndScaleSet> scroll_info;
|
| +
|
| + gfx::Vector2d scroll_delta(0, inner_viewport.height());
|
| + EXPECT_EQ(InputHandler::ScrollStarted,
|
| + host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
|
| +
|
| + // The child should have scrolled up to its limit.
|
| + scroll_info = host_impl_->ProcessScrollDeltas();
|
| + ASSERT_EQ(1u, scroll_info->scrolls.size());
|
| + ExpectContains(*scroll_info, child_scroll->id(), scroll_delta);
|
| + EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_scroll);
|
| +
|
| + // 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::ScrollStarted, host_impl_->FlingScrollBegin());
|
| + EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
|
| + EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), inner_scroll);
|
| +
|
| + // The inner viewport should have scrolled up to its limit.
|
| + scroll_info = host_impl_->ProcessScrollDeltas();
|
| + ASSERT_EQ(2u, scroll_info->scrolls.size());
|
| + ExpectContains(*scroll_info, child_scroll->id(), scroll_delta);
|
| + 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_EQ(host_impl_->CurrentlyScrollingLayer(), inner_scroll);
|
| + host_impl_->ScrollEnd();
|
| + }
|
| +}
|
| +
|
| class LayerTreeHostImplWithImplicitLimitsTest : public LayerTreeHostImplTest {
|
| public:
|
| void SetUp() override {
|
|
|