Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
static std::unique_ptr<Array<protocol::LayerTree::ScrollRect>>
buildScrollRectsForLayer(GraphicsLayer* graphicsLayer,
                         bool reportWheelScrollers) {
  std::unique_ptr<Array<protocol::LayerTree::ScrollRect>> scrollRects =
      Array<protocol::LayerTree::ScrollRect>::create();
  WebLayer* webLayer = graphicsLayer->platformLayer();
  WebVector<WebRect> nonFastScrollableRects =
      webLayer->nonFastScrollableRegion();
  for (size_t i = 0; i < nonFastScrollableRects.size(); ++i) {
    scrollRects->addItem(buildScrollRect(
        nonFastScrollableRects[i],
        protocol::LayerTree::ScrollRect::TypeEnum::RepaintsOnScroll));
  }
  WebVector<WebRect> touchEventHandlerRects =
      webLayer->touchEventHandlerRegion();
  for (size_t i = 0; i < touchEventHandlerRects.size(); ++i) {
    scrollRects->addItem(buildScrollRect(
        touchEventHandlerRects[i],
        protocol::LayerTree::ScrollRect::TypeEnum::TouchEventHandler));
  }
  if (reportWheelScrollers) {
    WebRect webRect(webLayer->position().x, webLayer->position().y,
                    webLayer->bounds().width, webLayer->bounds().height);
    scrollRects->addItem(buildScrollRect(
        webRect, protocol::LayerTree::ScrollRect::TypeEnum::WheelEventHandler));
  }
  return scrollRects->length() ? std::move(scrollRects) : nullptr;
}
TEST_F(ScrollingCoordinatorTest, clippedBodyTest)
{
    registerMockedHttpURLLoad("clipped-body.html");
    navigateTo(m_baseURL + "clipped-body.html");
    forceFullCompositingUpdate();

    WebLayer* rootScrollLayer = getRootScrollLayer();
    ASSERT_EQ(0u, rootScrollLayer->nonFastScrollableRegion().size());
}
Exemplo n.º 4
0
TEST_F(ScrollingCoordinatorChromiumTest, nonFastScrollableRegion)
{
    registerMockedHttpURLLoad("non-fast-scrollable.html");
    navigateTo(m_baseURL + "non-fast-scrollable.html");

    WebLayer* rootScrollLayer = getRootScrollLayer();
    WebVector<WebRect> nonFastScrollableRegion = rootScrollLayer->nonFastScrollableRegion();

    ASSERT_EQ(1u, nonFastScrollableRegion.size());
    ASSERT_EQ(WebRect(8, 8, 10, 10), nonFastScrollableRegion[0]);
}