void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction) { ASSERT(isMainThread()); if (!m_page) return; FrameView* frameView = m_page->mainFrame()->view(); if (!frameView) return; bool oldProgrammaticScroll = frameView->inProgrammaticScroll(); frameView->setInProgrammaticScroll(programmaticScroll); frameView->setConstrainsScrollingToContentEdge(false); frameView->notifyScrollPositionChanged(scrollPosition); frameView->setConstrainsScrollingToContentEdge(true); frameView->setInProgrammaticScroll(oldProgrammaticScroll); #if USE(ACCELERATED_COMPOSITING) if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) { if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) scrollLayer->setPosition(-frameView->scrollPosition()); else { scrollLayer->syncPosition(-frameView->scrollPosition()); LayoutRect viewportRect = frameView->visibleContentRect(); viewportRect.setLocation(IntPoint(frameView->scrollOffsetForFixedPosition())); syncChildPositions(viewportRect); } } #else UNUSED_PARAM(scrollingLayerPositionAction); #endif }
void ScrollingCoordinatorChromium::setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons reasons) { // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves. setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); if (m_private->scrollLayer()) m_private->scrollLayer()->setShouldScrollOnMainThread(reasons); }
void ScrollingCoordinatorChromium::setWheelEventHandlerCount(unsigned wheelEventHandlerCount) { // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves. setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); if (m_private->scrollLayer()) m_private->scrollLayer()->setHaveWheelEventHandlers(wheelEventHandlerCount > 0); }
void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll) { ASSERT(isMainThread()); if (!m_page) return; FrameView* frameView = m_page->mainFrame()->view(); if (!frameView) return; bool oldProgrammaticScroll = frameView->inProgrammaticScroll(); frameView->setInProgrammaticScroll(programmaticScroll); frameView->setConstrainsScrollingToContentEdge(false); frameView->notifyScrollPositionChanged(scrollPosition); frameView->setConstrainsScrollingToContentEdge(true); frameView->setInProgrammaticScroll(oldProgrammaticScroll); #if USE(ACCELERATED_COMPOSITING) if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) { if (programmaticScroll) scrollLayer->setPosition(-frameView->scrollPosition()); else scrollLayer->syncPosition(-frameView->scrollPosition()); } #endif }
void AsyncScrollingCoordinator::frameViewRootLayerDidChange(FrameView& frameView) { ASSERT(isMainThread()); ASSERT(m_page); if (!coordinatesScrollingForFrameView(frameView)) return; // FIXME: In some navigation scenarios, the FrameView has no RenderView or that RenderView has not been composited. // This needs cleaning up: https://bugs.webkit.org/show_bug.cgi?id=132724 if (!frameView.scrollLayerID()) return; // If the root layer does not have a ScrollingStateNode, then we should create one. ensureRootStateNodeForFrameView(frameView); ASSERT(m_scrollingStateTree->rootStateNode()); ScrollingCoordinator::frameViewRootLayerDidChange(frameView); ScrollingStateFrameScrollingNode* node = downcast<ScrollingStateFrameScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView.scrollLayerID())); node->setLayer(scrollLayerForFrameView(frameView)); node->setScrolledContentsLayer(rootContentLayerForFrameView(frameView)); node->setCounterScrollingLayer(counterScrollingLayerForFrameView(frameView)); node->setInsetClipLayer(insetClipLayerForFrameView(frameView)); node->setContentShadowLayer(contentShadowLayerForFrameView(frameView)); node->setHeaderLayer(headerLayerForFrameView(frameView)); node->setFooterLayer(footerLayerForFrameView(frameView)); node->setScrollBehaviorForFixedElements(frameView.scrollBehaviorForFixedElements()); }
void ScrollingCoordinator::updateMainFrameScrollPositionAndScrollLayerPosition() { #if USE(ACCELERATED_COMPOSITING) && ENABLE(THREADED_SCROLLING) ASSERT(isMainThread()); if (!m_page) return; FrameView* frameView = m_page->mainFrame()->view(); if (!frameView) return; IntPoint scrollPosition = m_scrollingTree->mainFrameScrollPosition(); // Make sure to update the main frame scroll position before changing the scroll layer position, // otherwise we'll introduce jittering on pages with slow repaint objects (like background-attachment: fixed). frameView->updateCompositingLayers(); frameView->setConstrainsScrollingToContentEdge(false); frameView->notifyScrollPositionChanged(scrollPosition); frameView->setConstrainsScrollingToContentEdge(true); if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) scrollLayer->setPosition(-frameView->scrollPosition()); #endif }
void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer) { if (!horizontalScrollbarLayer || !coordinatesScrollingForFrameView(frameView)) return; setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); m_private->setHorizontalScrollbarLayer(createScrollbarLayer(frameView->horizontalScrollbar(), m_private->scrollLayer(), horizontalScrollbarLayer, frameView)); }
void ScrollingCoordinatorChromium::frameViewVerticalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* verticalScrollbarLayer) { if (!verticalScrollbarLayer || !coordinatesScrollingForFrameView(frameView)) return; setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); m_private->setVerticalScrollbarLayer(createScrollbarLayer(frameView->verticalScrollbar(), m_private->scrollLayer(), verticalScrollbarLayer, frameView)); }
void ScrollingCoordinatorChromium::setTouchEventTargetRects(const Vector<IntRect>& absoluteHitTestRects) { // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves. setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); if (m_private->scrollLayer()) { WebVector<WebRect> webRects(absoluteHitTestRects.size()); for (size_t i = 0; i < absoluteHitTestRects.size(); ++i) webRects[i] = absoluteHitTestRects[i]; m_private->scrollLayer()->setTouchEventHandlerRegion(webRects); } }
void ScrollingCoordinatorChromium::setNonFastScrollableRegion(const Region& region) { // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves. setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); if (m_private->scrollLayer()) { Vector<IntRect> rects = region.rects(); WebVector<WebRect> webRects(rects.size()); for (size_t i = 0; i < rects.size(); ++i) webRects[i] = rects[i]; m_private->scrollLayer()->setNonFastScrollableRegion(webRects); } }
void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction) { ASSERT(isMainThread()); if (!m_page) return; FrameView* frameView = m_page->mainFrame().view(); if (!frameView) return; bool oldProgrammaticScroll = frameView->inProgrammaticScroll(); frameView->setInProgrammaticScroll(programmaticScroll); frameView->setConstrainsScrollingToContentEdge(false); frameView->notifyScrollPositionChanged(scrollPosition); frameView->setConstrainsScrollingToContentEdge(true); frameView->setInProgrammaticScroll(oldProgrammaticScroll); #if USE(ACCELERATED_COMPOSITING) if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) { GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView); GraphicsLayer* headerLayer = headerLayerForFrameView(frameView); GraphicsLayer* footerLayer = footerLayerForFrameView(frameView); IntSize scrollOffsetForFixed = frameView->scrollOffsetForFixedPosition(); if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) { scrollLayer->setPosition(-frameView->scrollPosition()); if (counterScrollingLayer) counterScrollingLayer->setPosition(IntPoint(scrollOffsetForFixed)); if (headerLayer) headerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), 0)); if (footerLayer) footerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), frameView->totalContentsSize().height() - frameView->footerHeight())); } else { scrollLayer->syncPosition(-frameView->scrollPosition()); if (counterScrollingLayer) counterScrollingLayer->syncPosition(IntPoint(scrollOffsetForFixed)); if (headerLayer) headerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), 0)); if (footerLayer) footerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), frameView->totalContentsSize().height() - frameView->footerHeight())); LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect(); syncChildPositions(viewportRect); } } #else UNUSED_PARAM(scrollingLayerPositionAction); #endif }
void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) { ASSERT(isMainThread()); ASSERT(m_page); if (frameView->frame() != m_page->mainFrame()) return; frameViewLayoutUpdated(frameView); recomputeWheelEventHandlerCount(); updateShouldUpdateScrollLayerPositionOnMainThread(); setScrollLayer(scrollLayerForFrameView(frameView)); }
void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction) { ASSERT(isMainThread()); if (!m_page) return; FrameView* frameView = m_page->mainFrame().view(); if (!frameView) return; bool oldProgrammaticScroll = frameView->inProgrammaticScroll(); frameView->setInProgrammaticScroll(programmaticScroll); frameView->setConstrainsScrollingToContentEdge(false); frameView->notifyScrollPositionChanged(roundedIntPoint(scrollPosition)); frameView->setConstrainsScrollingToContentEdge(true); frameView->setInProgrammaticScroll(oldProgrammaticScroll); if (scrollingNodeID == frameView->scrollLayerID()) { if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) { GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView); GraphicsLayer* headerLayer = headerLayerForFrameView(frameView); GraphicsLayer* footerLayer = footerLayerForFrameView(frameView); IntSize scrollOffsetForFixed = frameView->scrollOffsetForFixedPosition(); if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) { scrollLayer->setPosition(-frameView->scrollPosition()); if (counterScrollingLayer) counterScrollingLayer->setPosition(IntPoint(scrollOffsetForFixed)); if (headerLayer) headerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), 0)); if (footerLayer) footerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), frameView->totalContentsSize().height() - frameView->footerHeight())); } else { scrollLayer->syncPosition(-frameView->scrollPosition()); if (counterScrollingLayer) counterScrollingLayer->syncPosition(IntPoint(scrollOffsetForFixed)); if (headerLayer) headerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), 0)); if (footerLayer) footerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), frameView->totalContentsSize().height() - frameView->footerHeight())); LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect(); syncChildPositions(viewportRect); } } } // FIXME: handle non-main scrolling nodes. }
void AsyncScrollingCoordinator::updateMainFrameScrollLayerPosition() { ASSERT(isMainThread()); if (!m_page) return; FrameView* frameView = m_page->mainFrame().view(); if (!frameView) return; if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(*frameView)) scrollLayer->setPosition(-frameView->scrollPosition()); }
void ScrollingCoordinatorChromium::touchEventTargetRectsDidChange(const Document* document) { #if ENABLE(TOUCH_EVENT_TRACKING) // Wait until after layout to update. if (m_page->mainFrame()->view()->needsLayout()) return; // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves. setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); if (m_private->scrollLayer()) { Vector<IntRect> touchEventTargetRects; computeAbsoluteTouchEventTargetRects(document, touchEventTargetRects); setTouchEventTargetRects(touchEventTargetRects); } #else UNUSED_PARAM(document); #endif }
PassOwnPtr<WebScrollbarLayer> ScrollingCoordinatorChromium::createScrollbarLayer(Scrollbar* scrollbar, WebLayer* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView) { ASSERT(scrollbar); ASSERT(scrollbarGraphicsLayer); if (!scrollLayer) { // FIXME: sometimes we get called before setScrollLayer, workaround by finding the scroll layout ourselves. scrollLayer = scrollableLayerForGraphicsLayer(scrollLayerForFrameView(frameView)); ASSERT(scrollLayer); } // Root layer non-overlay scrollbars should be marked opaque to disable // blending. bool isOpaqueRootScrollbar = !frameView->parent() && !scrollbar->isOverlayScrollbar(); if (!scrollbarGraphicsLayer->contentsOpaque()) scrollbarGraphicsLayer->setContentsOpaque(isOpaqueRootScrollbar); // FIXME: Mac scrollbar themes are not thread-safe to paint. bool platformSupported = true; #if OS(DARWIN) platformSupported = false; #endif if (!platformSupported || scrollbar->isCustomScrollbar()) { scrollbarGraphicsLayer->setContentsToMedia(0); scrollbarGraphicsLayer->setDrawsContent(true); return nullptr; } // All Chromium scrollbar themes derive from ScrollbarThemeComposite. ScrollbarThemeComposite* themeComposite = static_cast<ScrollbarThemeComposite*>(scrollbar->theme()); WebKit::WebScrollbarThemePainter painter(themeComposite, scrollbar); OwnPtr<WebKit::WebScrollbarThemeGeometry> geometry(WebKit::WebScrollbarThemeGeometryNative::create(themeComposite)); OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(WebKit::Platform::current()->compositorSupport()->createScrollbarLayer(new WebKit::WebScrollbarImpl(scrollbar), painter, geometry.leakPtr())); scrollbarLayer->setScrollLayer(scrollLayer); GraphicsLayerChromium::registerContentsLayer(scrollbarLayer->layer()); scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer->layer()); scrollbarGraphicsLayer->setDrawsContent(false); scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaque()); return scrollbarLayer.release(); }
void AsyncScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) { ASSERT(isMainThread()); ASSERT(m_page); if (!coordinatesScrollingForFrameView(frameView)) return; // If the root layer does not have a ScrollingStateNode, then we should create one. ensureRootStateNodeForFrameView(frameView); ASSERT(m_scrollingStateTree->rootStateNode()); ScrollingCoordinator::frameViewRootLayerDidChange(frameView); ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID())); setScrollLayerForNode(scrollLayerForFrameView(frameView), node); setCounterScrollingLayerForNode(counterScrollingLayerForFrameView(frameView), node); setHeaderLayerForNode(headerLayerForFrameView(frameView), node); setFooterLayerForNode(footerLayerForFrameView(frameView), node); setScrollBehaviorForFixedElementsForNode(frameView->scrollBehaviorForFixedElements(), node); }
static PassRefPtr<ScrollbarLayerChromium> createScrollbarLayer(Scrollbar* scrollbar, LayerChromium* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView) { ASSERT(scrollbar); ASSERT(scrollbarGraphicsLayer); if (!scrollLayer) { // FIXME: sometimes we get called before setScrollLayer, workaround by finding the scroll layout ourselves. scrollLayer = scrollLayerForFrameView(frameView)->platformLayer(); ASSERT(scrollLayer); } // Root layer non-overlay scrollbars should be marked opaque to disable // blending. bool isOpaqueRootScrollbar = !frameView->parent() && !scrollbar->isOverlayScrollbar(); if (!scrollbarGraphicsLayer->contentsOpaque()) scrollbarGraphicsLayer->setContentsOpaque(isOpaqueRootScrollbar); // FIXME: Mac scrollbar themes are not thread-safe. bool platformSupported = true; #if OS(DARWIN) platformSupported = false; #endif if (!platformSupported || scrollbar->isOverlayScrollbar()) { scrollbarGraphicsLayer->setContentsToMedia(0); scrollbarGraphicsLayer->setDrawsContent(true); return 0; } RefPtr<ScrollbarLayerChromium> scrollbarLayer = ScrollbarLayerChromium::create(scrollbar, scrollLayer->id()); scrollbarGraphicsLayer->setContentsToMedia(scrollbarLayer.get()); scrollbarGraphicsLayer->setDrawsContent(false); scrollbarLayer->setOpaque(scrollbarGraphicsLayer->contentsOpaque()); return scrollbarLayer.release(); }
void ScrollingCoordinatorChromium::frameViewRootLayerDidChange(FrameView* frameView) { ScrollingCoordinator::frameViewRootLayerDidChange(frameView); setScrollLayer(scrollLayerForFrameView(frameView)); }
void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction) { ASSERT(isMainThread()); if (!m_page) return; FrameView* frameViewPtr = frameViewForScrollingNode(scrollingNodeID); if (!frameViewPtr) return; FrameView& frameView = *frameViewPtr; if (scrollingNodeID == frameView.scrollLayerID()) { bool oldProgrammaticScroll = frameView.inProgrammaticScroll(); frameView.setInProgrammaticScroll(programmaticScroll); frameView.setConstrainsScrollingToContentEdge(false); frameView.notifyScrollPositionChanged(roundedIntPoint(scrollPosition)); frameView.setConstrainsScrollingToContentEdge(true); frameView.setInProgrammaticScroll(oldProgrammaticScroll); if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) { GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView); GraphicsLayer* insetClipLayer = insetClipLayerForFrameView(frameView); GraphicsLayer* contentShadowLayer = contentShadowLayerForFrameView(frameView); GraphicsLayer* scrolledContentsLayer = rootContentLayerForFrameView(frameView); GraphicsLayer* headerLayer = headerLayerForFrameView(frameView); GraphicsLayer* footerLayer = footerLayerForFrameView(frameView); LayoutPoint scrollPositionForFixed = frameView.scrollPositionForFixedPosition(); float topContentInset = frameView.topContentInset(); FloatPoint positionForInsetClipLayer = FloatPoint(0, FrameView::yPositionForInsetClipLayer(scrollPosition, topContentInset)); FloatPoint positionForContentsLayer = frameView.positionForRootContentLayer(); FloatPoint positionForHeaderLayer = FloatPoint(scrollPositionForFixed.x(), FrameView::yPositionForHeaderLayer(scrollPosition, topContentInset)); FloatPoint positionForFooterLayer = FloatPoint(scrollPositionForFixed.x(), FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, frameView.totalContentsSize().height(), frameView.footerHeight())); if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) { scrollLayer->setPosition(-frameView.scrollPosition()); if (counterScrollingLayer) counterScrollingLayer->setPosition(scrollPositionForFixed); if (insetClipLayer) insetClipLayer->setPosition(positionForInsetClipLayer); if (contentShadowLayer) contentShadowLayer->setPosition(positionForContentsLayer); if (scrolledContentsLayer) scrolledContentsLayer->setPosition(positionForContentsLayer); if (headerLayer) headerLayer->setPosition(positionForHeaderLayer); if (footerLayer) footerLayer->setPosition(positionForFooterLayer); } else { scrollLayer->syncPosition(-frameView.scrollPosition()); if (counterScrollingLayer) counterScrollingLayer->syncPosition(scrollPositionForFixed); if (insetClipLayer) insetClipLayer->syncPosition(positionForInsetClipLayer); if (contentShadowLayer) contentShadowLayer->syncPosition(positionForContentsLayer); if (scrolledContentsLayer) scrolledContentsLayer->syncPosition(positionForContentsLayer); if (headerLayer) headerLayer->syncPosition(positionForHeaderLayer); if (footerLayer) footerLayer->syncPosition(positionForFooterLayer); LayoutRect viewportRect = frameView.viewportConstrainedVisibleContentRect(); syncChildPositions(viewportRect); } } #if PLATFORM(COCOA) if (m_page->expectsWheelEventTriggers()) { frameView.scrollAnimator().setWheelEventTestTrigger(m_page->testTrigger()); if (const auto& trigger = m_page->testTrigger()) trigger->removeTestDeferralForReason(reinterpret_cast<WheelEventTestTrigger::ScrollableAreaIdentifier>(scrollingNodeID), WheelEventTestTrigger::ScrollingThreadSyncNeeded); } #endif return; } // Overflow-scroll area. if (ScrollableArea* scrollableArea = frameView.scrollableAreaForScrollLayerID(scrollingNodeID)) { scrollableArea->setIsUserScroll(scrollingLayerPositionAction == SyncScrollingLayerPosition); scrollableArea->scrollToOffsetWithoutAnimation(scrollPosition); scrollableArea->setIsUserScroll(false); if (scrollingLayerPositionAction == SetScrollingLayerPosition) m_page->editorClient().overflowScrollPositionChanged(); #if PLATFORM(COCOA) if (m_page->expectsWheelEventTriggers()) { frameView.scrollAnimator().setWheelEventTestTrigger(m_page->testTrigger()); if (const auto& trigger = m_page->testTrigger()) trigger->removeTestDeferralForReason(reinterpret_cast<WheelEventTestTrigger::ScrollableAreaIdentifier>(scrollingNodeID), WheelEventTestTrigger::ScrollingThreadSyncNeeded); } #endif } }
void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction) { ASSERT(isMainThread()); if (!m_page) return; FrameView* frameView = m_page->mainFrame().view(); if (!frameView) return; // Main frame. if (scrollingNodeID == frameView->scrollLayerID()) { bool oldProgrammaticScroll = frameView->inProgrammaticScroll(); frameView->setInProgrammaticScroll(programmaticScroll); frameView->setConstrainsScrollingToContentEdge(false); frameView->notifyScrollPositionChanged(roundedIntPoint(scrollPosition)); frameView->setConstrainsScrollingToContentEdge(true); frameView->setInProgrammaticScroll(oldProgrammaticScroll); if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) { GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView); GraphicsLayer* insetClipLayer = insetClipLayerForFrameView(frameView); GraphicsLayer* contentShadowLayer = contentShadowLayerForFrameView(frameView); GraphicsLayer* scrolledContentsLayer = rootContentLayerForFrameView(frameView); GraphicsLayer* headerLayer = headerLayerForFrameView(frameView); GraphicsLayer* footerLayer = footerLayerForFrameView(frameView); LayoutSize scrollOffsetForFixed = frameView->scrollOffsetForFixedPosition(); float topContentInset = frameView->topContentInset(); FloatPoint positionForInsetClipLayer = FloatPoint(0, FrameView::yPositionForInsetClipLayer(scrollPosition, topContentInset)); FloatPoint positionForContentsLayer = FloatPoint(scrolledContentsLayer->position().x(), FrameView::yPositionForRootContentLayer(scrollPosition, topContentInset, frameView->headerHeight())); FloatPoint positionForHeaderLayer = FloatPoint(scrollOffsetForFixed.width(), FrameView::yPositionForHeaderLayer(scrollPosition, topContentInset)); FloatPoint positionForFooterLayer = FloatPoint(scrollOffsetForFixed.width(), FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, frameView->totalContentsSize().height(), frameView->footerHeight())); if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) { scrollLayer->setPosition(-frameView->scrollPosition()); if (counterScrollingLayer) counterScrollingLayer->setPosition(toLayoutPoint(scrollOffsetForFixed)); if (insetClipLayer) insetClipLayer->setPosition(positionForInsetClipLayer); if (contentShadowLayer) contentShadowLayer->setPosition(positionForContentsLayer); if (scrolledContentsLayer) scrolledContentsLayer->setPosition(positionForContentsLayer); if (headerLayer) headerLayer->setPosition(positionForHeaderLayer); if (footerLayer) footerLayer->setPosition(positionForFooterLayer); } else { scrollLayer->syncPosition(-frameView->scrollPosition()); if (counterScrollingLayer) counterScrollingLayer->syncPosition(toLayoutPoint(scrollOffsetForFixed)); if (insetClipLayer) insetClipLayer->syncPosition(positionForInsetClipLayer); if (contentShadowLayer) contentShadowLayer->syncPosition(positionForContentsLayer); if (scrolledContentsLayer) scrolledContentsLayer->syncPosition(positionForContentsLayer); if (headerLayer) headerLayer->syncPosition(positionForHeaderLayer); if (footerLayer) footerLayer->syncPosition(positionForFooterLayer); LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect(); syncChildPositions(viewportRect); } } return; } // Overflow-scroll area. if (ScrollableArea* scrollableArea = frameView->scrollableAreaForScrollLayerID(scrollingNodeID)) { scrollableArea->setIsUserScroll(scrollingLayerPositionAction == SyncScrollingLayerPosition); scrollableArea->scrollToOffsetWithoutAnimation(scrollPosition); scrollableArea->setIsUserScroll(false); } }