Chromium Code Reviews| 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 a82de31691a1547c794c37727430cdb39160baa1..c431b868efa526430ed845990c275bfe1e88b9b7 100644 |
| --- a/cc/trees/layer_tree_host_impl_unittest.cc |
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc |
| @@ -1018,6 +1018,59 @@ TEST_F(LayerTreeHostImplTest, ScrollWithOverlappingNonScrollableLayer) { |
| EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); |
| } |
| +TEST_F(LayerTreeHostImplTest, ScrolledOverlappingDrawnScrollbarLayer) { |
| + LayerTreeImpl* layer_tree_impl = host_impl_->active_tree(); |
| + gfx::Size content_size = gfx::Size(360, 600); |
| + gfx::Size scroll_content_size = gfx::Size(345, 3800); |
| + gfx::Size scrollbar_size = gfx::Size(15, 600); |
| + |
| + host_impl_->SetViewportSize(content_size); |
| + std::unique_ptr<LayerImpl> root = LayerImpl::Create(layer_tree_impl, 1); |
| + root->SetBounds(content_size); |
| + root->SetPosition(gfx::PointF()); |
| + |
| + std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 2); |
| + clip->SetBounds(content_size); |
| + clip->SetPosition(gfx::PointF()); |
| + |
| + std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); |
| + scroll->SetBounds(scroll_content_size); |
| + scroll->SetScrollClipLayer(clip->id()); |
| + scroll->SetDrawsContent(true); |
| + |
| + std::unique_ptr<SolidColorScrollbarLayerImpl> drawnScrollbar = |
|
ajuma
2017/02/28 00:38:58
drawn_scrollbar
pdr.
2017/02/28 01:01:36
third_party/WebKitten spotted! :D
Done
|
| + SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, |
| + false, true); |
| + drawnScrollbar->SetBounds(scrollbar_size); |
| + drawnScrollbar->SetPosition(gfx::PointF(345, 0)); |
| + drawnScrollbar->SetScrollLayerId(scroll->id()); |
| + drawnScrollbar->SetDrawsContent(true); |
| + drawnScrollbar->test_properties()->opacity = 1.f; |
| + |
| + std::unique_ptr<LayerImpl> squash = LayerImpl::Create(layer_tree_impl, 5); |
| + squash->SetBounds(gfx::Size(140, 300)); |
| + squash->SetPosition(gfx::PointF(220, 0)); |
| + squash->SetDrawsContent(true); |
| + |
| + scroll->test_properties()->AddChild(std::move(drawnScrollbar)); |
| + scroll->test_properties()->AddChild(std::move(squash)); |
| + clip->test_properties()->AddChild(std::move(scroll)); |
| + root->test_properties()->AddChild(std::move(clip)); |
| + |
| + layer_tree_impl->SetRootLayerForTesting(std::move(root)); |
| + layer_tree_impl->BuildPropertyTreesForTesting(); |
| + layer_tree_impl->DidBecomeActive(); |
| + |
| + // The point hits squash layer and also scrollbar layer, but because the |
| + // scrollbar layer is not an ancestor of squash, we cannot scroll on the impl |
|
ajuma
2017/02/28 00:38:58
Just to clarify, would things change at all if scr
pdr.
2017/02/28 01:01:36
This comment was incorrectly cribbed from ScrollWi
|
| + // thread. |
| + auto status = host_impl_->ScrollBegin(BeginState(gfx::Point(350, 150)).get(), |
| + InputHandler::WHEEL); |
| + EXPECT_EQ(InputHandler::SCROLL_UNKNOWN, status.thread); |
| + EXPECT_EQ(MainThreadScrollingReason::kFailedHitTest, |
| + status.main_thread_scrolling_reasons); |
| +} |
| + |
| TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) { |
| SetupScrollAndContentsLayers(gfx::Size(200, 200)); |
| host_impl_->SetViewportSize(gfx::Size(100, 100)); |