TEST_F(ScrollingCoordinatorChromiumTest, wheelEventHandler) { registerMockedHttpURLLoad("wheel-event-handler.html"); navigateTo(m_baseURL + "wheel-event-handler.html"); WebLayer* rootScrollLayer = getRootScrollLayer(); ASSERT_TRUE(rootScrollLayer->haveWheelEventHandlers()); }
static PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > buildScrollRectsForLayer(GraphicsLayer* graphicsLayer) { RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>::create(); WebLayer* webLayer = graphicsLayer->platformLayer(); for (size_t i = 0; i < webLayer->nonFastScrollableRegion().size(); ++i) { scrollRects->addItem(buildScrollRect(webLayer->nonFastScrollableRegion()[i], TypeBuilder::LayerTree::ScrollRect::Type::RepaintsOnScroll)); } for (size_t i = 0; i < webLayer->touchEventHandlerRegion().size(); ++i) { scrollRects->addItem(buildScrollRect(webLayer->touchEventHandlerRegion()[i], TypeBuilder::LayerTree::ScrollRect::Type::TouchEventHandler)); } if (webLayer->haveWheelEventHandlers()) { WebRect webRect(webLayer->position().x, webLayer->position().y, webLayer->bounds().width, webLayer->bounds().height); scrollRects->addItem(buildScrollRect(webRect, TypeBuilder::LayerTree::ScrollRect::Type::WheelEventHandler)); } return scrollRects->length() ? scrollRects.release() : nullptr; }
TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingByDefault) { navigateTo("about:blank"); // Make sure the scrolling coordinator is active. FrameView* frameView = m_webViewImpl->mainFrameImpl()->frameView(); Page* page = m_webViewImpl->mainFrameImpl()->frame()->page(); ASSERT_TRUE(page->scrollingCoordinator()); ASSERT_TRUE(page->scrollingCoordinator()->coordinatesScrollingForFrameView(frameView)); // Fast scrolling should be enabled by default. WebLayer* rootScrollLayer = getRootScrollLayer(); ASSERT_TRUE(rootScrollLayer->scrollable()); ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); ASSERT_FALSE(rootScrollLayer->haveWheelEventHandlers()); }