void ScrollingCoordinatorChromium::scrollableAreaScrollLayerDidChange(ScrollableArea* scrollableArea) { GraphicsLayerChromium* scrollLayer = static_cast<GraphicsLayerChromium*>(scrollLayerForScrollableArea(scrollableArea)); if (scrollLayer) scrollLayer->setScrollableArea(scrollableArea); WebLayer* webLayer = scrollingWebLayerForScrollableArea(scrollableArea); if (webLayer) { webLayer->setScrollable(true); webLayer->setScrollPosition(IntPoint(scrollableArea->scrollPosition() - scrollableArea->minimumScrollPosition())); webLayer->setMaxScrollPosition(IntSize(scrollableArea->scrollSize(HorizontalScrollbar), scrollableArea->scrollSize(VerticalScrollbar))); } if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, HorizontalScrollbar)) setupScrollbarLayer(horizontalScrollbarLayerForScrollableArea(scrollableArea), scrollbarLayer, webLayer); if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, VerticalScrollbar)) setupScrollbarLayer(verticalScrollbarLayerForScrollableArea(scrollableArea), scrollbarLayer, webLayer); }
void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) { if (!haveScrollLayer()) return; bool visibleRectChanged = m_viewportSize != viewportSize; m_viewportSize = viewportSize; WebLayer* layer = scrollLayer(); layer->setScrollPosition(scrollPosition + scrollOrigin); layer->setPosition(WebFloatPoint(-scrollPosition)); // Due to the possibility of pinch zoom, the noncomposited layer is always // assumed to be scrollable. layer->setScrollable(true); m_graphicsLayer->setSize(contentsSize); // In RTL-style pages, the origin of the initial containing block for the // root layer may be positive; translate the layer to avoid negative // coordinates. m_layerAdjust = -toSize(scrollOrigin); if (m_graphicsLayer->transform().m41() != m_layerAdjust.width() || m_graphicsLayer->transform().m42() != m_layerAdjust.height()) { WebCore::TransformationMatrix transform = m_graphicsLayer->transform(); transform.setM41(m_layerAdjust.width()); transform.setM42(m_layerAdjust.height()); m_graphicsLayer->setTransform(transform); // If a tiled layer is shifted left or right, the content that goes into // each tile will change. Invalidate the entire layer when this happens. m_graphicsLayer->setNeedsDisplay(); } else if (visibleRectChanged) m_graphicsLayer->setNeedsDisplay(); WebCore::GraphicsLayer* clipLayer = m_graphicsLayer->parent()->parent(); WebCore::GraphicsLayer* rootLayer = clipLayer; while (rootLayer->parent()) rootLayer = rootLayer->parent(); setScrollbarBoundsContainPageScale(rootLayer, clipLayer); }