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; }
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; }