Changeset 182132 in webkit


Ignore:
Timestamp:
Mar 29, 2015, 9:13:45 PM (10 years ago)
Author:
Simon Fraser
Message:

Convert arguments to ScrollingCoordinator functions to references
https://bugs.webkit.org/show_bug.cgi?id=143198

Reviewed by Darin Adler.

Convert all the FrameView* and ScrollableArea* arguments to ScrollingCoordinator functions to
references, and use references in a few other places.

Source/WebCore:

  • dom/Document.cpp:

(WebCore::wheelEventHandlerCountChanged):

  • loader/HistoryController.cpp:

(WebCore::HistoryController::restoreScrollPositionAndViewState):

  • page/DebugPageOverlays.cpp:

(WebCore::NonFastScrollableRegionOverlay::updateRegion):

  • page/Frame.cpp:

(WebCore::Frame::willDetachPage):

  • page/FrameView.cpp:

(WebCore::FrameView::prepareForDetach):
(WebCore::FrameView::addSlowRepaintObject):
(WebCore::FrameView::removeSlowRepaintObject):
(WebCore::FrameView::addViewportConstrainedObject):
(WebCore::FrameView::removeViewportConstrainedObject):
(WebCore::FrameView::requestScrollPositionUpdate):
(WebCore::FrameView::performPostLayoutTasks):
(WebCore::FrameView::scrollableAreaSetChanged):
(WebCore::FrameView::wheelEvent):

  • page/Page.cpp:

(WebCore::Page::nonFastScrollableRects):

  • page/Page.h:
  • page/scrolling/AsyncScrollingCoordinator.cpp:

(WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
(WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
(WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
(WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
(WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
(WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
(WebCore::AsyncScrollingCoordinator::updateMainFrameScrollLayerPosition):
(WebCore::AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView):

  • page/scrolling/AsyncScrollingCoordinator.h:
  • page/scrolling/ScrollingCoordinator.cpp:

(WebCore::ScrollingCoordinator::pageDestroyed):
(WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView):
(WebCore::ScrollingCoordinator::computeNonFastScrollableRegion):
(WebCore::ScrollingCoordinator::frameViewWheelEventHandlerCountChanged):
(WebCore::ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange):
(WebCore::ScrollingCoordinator::frameViewFixedObjectsDidChange):
(WebCore::ScrollingCoordinator::scrollLayerForScrollableArea):
(WebCore::ScrollingCoordinator::scrollLayerForFrameView):
(WebCore::ScrollingCoordinator::headerLayerForFrameView):
(WebCore::ScrollingCoordinator::footerLayerForFrameView):
(WebCore::ScrollingCoordinator::counterScrollingLayerForFrameView):
(WebCore::ScrollingCoordinator::insetClipLayerForFrameView):
(WebCore::ScrollingCoordinator::contentShadowLayerForFrameView):
(WebCore::ScrollingCoordinator::rootContentLayerForFrameView):
(WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
(WebCore::ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects):
(WebCore::ScrollingCoordinator::synchronousScrollingReasons):
(WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons):
(WebCore::ScrollingCoordinator::setForceSynchronousScrollLayerPositionUpdates):
(WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously):
(WebCore::ScrollingCoordinator::replaySessionStateDidChange):
(WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):

  • page/scrolling/ScrollingCoordinator.h: Align the bitmask enums to make mistakes easier to spot.

(WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
(WebCore::ScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
(WebCore::ScrollingCoordinator::requestScrollPositionUpdate):
(WebCore::ScrollingCoordinator::handleWheelEvent):
(WebCore::ScrollingCoordinator::willDestroyScrollableArea):
(WebCore::ScrollingCoordinator::scrollableAreaScrollLayerDidChange):
(WebCore::ScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
(WebCore::ScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView):

  • page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:

(WebCore::ScrollingCoordinatorCoordinatedGraphics::scrollableAreaScrollLayerDidChange):
(WebCore::ScrollingCoordinatorCoordinatedGraphics::willDestroyScrollableArea):
(WebCore::ScrollingCoordinatorCoordinatedGraphics::requestScrollPositionUpdate):

  • page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h:
  • page/scrolling/ios/ScrollingCoordinatorIOS.h:
  • page/scrolling/mac/ScrollingCoordinatorMac.h:
  • page/scrolling/mac/ScrollingCoordinatorMac.mm:

(WebCore::ScrollingCoordinatorMac::handleWheelEvent):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::~RenderLayer):

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateOverflowControlsLayers):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::updateBacking):
(WebCore::RenderLayerCompositor::hasCoordinatedScrolling):
(WebCore::RenderLayerCompositor::scrollingLayerDidChange):
(WebCore::RenderLayerCompositor::updateLayerForHeader):
(WebCore::RenderLayerCompositor::updateLayerForFooter):
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
(WebCore::RenderLayerCompositor::destroyRootLayer):
(WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
(WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
(WebCore::RenderLayerCompositor::didAddScrollingLayer):

  • testing/Internals.cpp:

(WebCore::Internals::nonFastScrollableRects):

Source/WebKit2:

  • WebProcess/Scrolling/RemoteScrollingCoordinator.h:
  • WebProcess/Scrolling/RemoteScrollingCoordinator.mm:

(WebKit::RemoteScrollingCoordinator::coordinatesScrollingForFrameView):

Location:
trunk/Source
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r182131 r182132  
     12015-03-29  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Convert arguments to ScrollingCoordinator functions to references
     4        https://bugs.webkit.org/show_bug.cgi?id=143198
     5
     6        Reviewed by Darin Adler.
     7
     8        Convert all the FrameView* and ScrollableArea* arguments to ScrollingCoordinator functions to
     9        references, and use references in a few other places.
     10
     11        * dom/Document.cpp:
     12        (WebCore::wheelEventHandlerCountChanged):
     13        * loader/HistoryController.cpp:
     14        (WebCore::HistoryController::restoreScrollPositionAndViewState):
     15        * page/DebugPageOverlays.cpp:
     16        (WebCore::NonFastScrollableRegionOverlay::updateRegion):
     17        * page/Frame.cpp:
     18        (WebCore::Frame::willDetachPage):
     19        * page/FrameView.cpp:
     20        (WebCore::FrameView::prepareForDetach):
     21        (WebCore::FrameView::addSlowRepaintObject):
     22        (WebCore::FrameView::removeSlowRepaintObject):
     23        (WebCore::FrameView::addViewportConstrainedObject):
     24        (WebCore::FrameView::removeViewportConstrainedObject):
     25        (WebCore::FrameView::requestScrollPositionUpdate):
     26        (WebCore::FrameView::performPostLayoutTasks):
     27        (WebCore::FrameView::scrollableAreaSetChanged):
     28        (WebCore::FrameView::wheelEvent):
     29        * page/Page.cpp:
     30        (WebCore::Page::nonFastScrollableRects):
     31        * page/Page.h:
     32        * page/scrolling/AsyncScrollingCoordinator.cpp:
     33        (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
     34        (WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
     35        (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
     36        (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
     37        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
     38        (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
     39        (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
     40        (WebCore::AsyncScrollingCoordinator::updateMainFrameScrollLayerPosition):
     41        (WebCore::AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView):
     42        * page/scrolling/AsyncScrollingCoordinator.h:
     43        * page/scrolling/ScrollingCoordinator.cpp:
     44        (WebCore::ScrollingCoordinator::pageDestroyed):
     45        (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView):
     46        (WebCore::ScrollingCoordinator::computeNonFastScrollableRegion):
     47        (WebCore::ScrollingCoordinator::frameViewWheelEventHandlerCountChanged):
     48        (WebCore::ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange):
     49        (WebCore::ScrollingCoordinator::frameViewFixedObjectsDidChange):
     50        (WebCore::ScrollingCoordinator::scrollLayerForScrollableArea):
     51        (WebCore::ScrollingCoordinator::scrollLayerForFrameView):
     52        (WebCore::ScrollingCoordinator::headerLayerForFrameView):
     53        (WebCore::ScrollingCoordinator::footerLayerForFrameView):
     54        (WebCore::ScrollingCoordinator::counterScrollingLayerForFrameView):
     55        (WebCore::ScrollingCoordinator::insetClipLayerForFrameView):
     56        (WebCore::ScrollingCoordinator::contentShadowLayerForFrameView):
     57        (WebCore::ScrollingCoordinator::rootContentLayerForFrameView):
     58        (WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
     59        (WebCore::ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects):
     60        (WebCore::ScrollingCoordinator::synchronousScrollingReasons):
     61        (WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons):
     62        (WebCore::ScrollingCoordinator::setForceSynchronousScrollLayerPositionUpdates):
     63        (WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously):
     64        (WebCore::ScrollingCoordinator::replaySessionStateDidChange):
     65        (WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
     66        * page/scrolling/ScrollingCoordinator.h: Align the bitmask enums to make mistakes easier to spot.
     67        (WebCore::ScrollingCoordinator::frameViewLayoutUpdated):
     68        (WebCore::ScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
     69        (WebCore::ScrollingCoordinator::requestScrollPositionUpdate):
     70        (WebCore::ScrollingCoordinator::handleWheelEvent):
     71        (WebCore::ScrollingCoordinator::willDestroyScrollableArea):
     72        (WebCore::ScrollingCoordinator::scrollableAreaScrollLayerDidChange):
     73        (WebCore::ScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
     74        (WebCore::ScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView):
     75        * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
     76        (WebCore::ScrollingCoordinatorCoordinatedGraphics::scrollableAreaScrollLayerDidChange):
     77        (WebCore::ScrollingCoordinatorCoordinatedGraphics::willDestroyScrollableArea):
     78        (WebCore::ScrollingCoordinatorCoordinatedGraphics::requestScrollPositionUpdate):
     79        * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h:
     80        * page/scrolling/ios/ScrollingCoordinatorIOS.h:
     81        * page/scrolling/mac/ScrollingCoordinatorMac.h:
     82        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
     83        (WebCore::ScrollingCoordinatorMac::handleWheelEvent):
     84        * rendering/RenderLayer.cpp:
     85        (WebCore::RenderLayer::~RenderLayer):
     86        * rendering/RenderLayerBacking.cpp:
     87        (WebCore::RenderLayerBacking::updateOverflowControlsLayers):
     88        * rendering/RenderLayerCompositor.cpp:
     89        (WebCore::RenderLayerCompositor::updateBacking):
     90        (WebCore::RenderLayerCompositor::hasCoordinatedScrolling):
     91        (WebCore::RenderLayerCompositor::scrollingLayerDidChange):
     92        (WebCore::RenderLayerCompositor::updateLayerForHeader):
     93        (WebCore::RenderLayerCompositor::updateLayerForFooter):
     94        (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
     95        (WebCore::RenderLayerCompositor::destroyRootLayer):
     96        (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
     97        (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
     98        (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
     99        (WebCore::RenderLayerCompositor::didAddScrollingLayer):
     100        * testing/Internals.cpp:
     101        (WebCore::Internals::nonFastScrollableRects):
     102
    11032015-03-29  Benjamin Poulain  <benjamin@webkit.org>
    2104
  • trunk/Source/WebCore/dom/Document.cpp

    r182022 r182132  
    59965996
    59975997    // FIXME: Why doesn't this need to be called in didBecomeCurrentDocumentInFrame?
    5998     scrollingCoordinator->frameViewWheelEventHandlerCountChanged(frameView);
     5998    scrollingCoordinator->frameViewWheelEventHandlerCountChanged(*frameView);
    59995999}
    60006000
  • trunk/Source/WebCore/loader/HistoryController.cpp

    r179472 r182132  
    139139        if (page && m_frame.isMainFrame()) {
    140140            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
    141                 scrollingCoordinator->frameViewRootLayerDidChange(view);
     141                scrollingCoordinator->frameViewRootLayerDidChange(*view);
    142142        }
    143143    }
  • trunk/Source/WebCore/page/DebugPageOverlays.cpp

    r181617 r182132  
    128128    if (Page* page = m_frame.page()) {
    129129        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
    130             *region = scrollingCoordinator->computeNonFastScrollableRegion(&m_frame, IntPoint());
     130            *region = scrollingCoordinator->computeNonFastScrollableRegion(m_frame, IntPoint());
    131131    }
    132132
  • trunk/Source/WebCore/page/Frame.cpp

    r180291 r182132  
    792792
    793793    if (page() && page()->scrollingCoordinator() && m_view)
    794         page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
     794        page()->scrollingCoordinator()->willDestroyScrollableArea(*m_view);
    795795
    796796#if PLATFORM(IOS)
  • trunk/Source/WebCore/page/FrameView.cpp

    r182033 r182132  
    359359    if (frame().page()) {
    360360        if (ScrollingCoordinator* scrollingCoordinator = frame().page()->scrollingCoordinator())
    361             scrollingCoordinator->willDestroyScrollableArea(this);
     361            scrollingCoordinator->willDestroyScrollableArea(*this);
    362362    }
    363363}
     
    15491549        if (Page* page = frame().page()) {
    15501550            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
    1551                 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this);
     1551                scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(*this);
    15521552        }
    15531553    }
     
    15661566        if (Page* page = frame().page()) {
    15671567            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
    1568                 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this);
     1568                scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(*this);
    15691569        }
    15701570    }
     
    15831583        if (Page* page = frame().page()) {
    15841584            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
    1585                 scrollingCoordinator->frameViewFixedObjectsDidChange(this);
     1585                scrollingCoordinator->frameViewFixedObjectsDidChange(*this);
    15861586        }
    15871587    }
     
    15931593        if (Page* page = frame().page()) {
    15941594            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
    1595                 scrollingCoordinator->frameViewFixedObjectsDidChange(this);
     1595                scrollingCoordinator->frameViewFixedObjectsDidChange(*this);
    15961596        }
    15971597
     
    22312231    if (Page* page = frame().page()) {
    22322232        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
    2233             return scrollingCoordinator->requestScrollPositionUpdate(this, position);
     2233            return scrollingCoordinator->requestScrollPositionUpdate(*this, position);
    22342234    }
    22352235#else
     
    29642964    if (auto* page = frame().page()) {
    29652965        if (auto* scrollingCoordinator = page->scrollingCoordinator())
    2966             scrollingCoordinator->frameViewLayoutUpdated(this);
     2966            scrollingCoordinator->frameViewLayoutUpdated(*this);
    29672967    }
    29682968
     
    43784378    if (auto* page = frame().page()) {
    43794379        if (auto* scrollingCoordinator = page->scrollingCoordinator())
    4380             scrollingCoordinator->frameViewNonFastScrollableRegionChanged(this);
     4380            scrollingCoordinator->frameViewNonFastScrollableRegionChanged(*this);
    43814381    }
    43824382}
     
    44304430    if (Page* page = frame().page()) {
    44314431        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) {
    4432             if (scrollingCoordinator->coordinatesScrollingForFrameView(this))
    4433                 return scrollingCoordinator->handleWheelEvent(this, wheelEvent);
     4432            if (scrollingCoordinator->coordinatesScrollingForFrameView(*this))
     4433                return scrollingCoordinator->handleWheelEvent(*this, wheelEvent);
    44344434        }
    44354435    }
  • trunk/Source/WebCore/page/Page.cpp

    r181838 r182132  
    370370}
    371371
    372 Ref<ClientRectList> Page::nonFastScrollableRects(const Frame* frame)
     372Ref<ClientRectList> Page::nonFastScrollableRects(const Frame& frame)
    373373{
    374374    if (Document* document = m_mainFrame->document())
  • trunk/Source/WebCore/page/Page.h

    r182033 r182132  
    194194    WEBCORE_EXPORT String scrollingStateTreeAsText();
    195195    WEBCORE_EXPORT String synchronousScrollingReasonsAsText();
    196     WEBCORE_EXPORT Ref<ClientRectList> nonFastScrollableRects(const Frame*);
     196    WEBCORE_EXPORT Ref<ClientRectList> nonFastScrollableRects(const Frame&);
    197197
    198198    Settings& settings() const { return *m_settings; }
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r178597 r182132  
    7474}
    7575
    76 void AsyncScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView)
     76void AsyncScrollingCoordinator::frameViewLayoutUpdated(FrameView& frameView)
    7777{
    7878    ASSERT(isMainThread());
     
    8888    // In the future, we may want to have the ability to set non-fast scrolling regions for more than
    8989    // just the root node. But right now, this concept only applies to the root.
    90     m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint()));
     90    m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint()));
    9191
    9292    if (!coordinatesScrollingForFrameView(frameView))
    9393        return;
    9494
    95     ScrollingStateFrameScrollingNode* node = downcast<ScrollingStateFrameScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
     95    ScrollingStateFrameScrollingNode* node = downcast<ScrollingStateFrameScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView.scrollLayerID()));
    9696    if (!node)
    9797        return;
    9898
    99     Scrollbar* verticalScrollbar = frameView->verticalScrollbar();
    100     Scrollbar* horizontalScrollbar = frameView->horizontalScrollbar();
     99    Scrollbar* verticalScrollbar = frameView.verticalScrollbar();
     100    Scrollbar* horizontalScrollbar = frameView.horizontalScrollbar();
    101101    node->setScrollbarPaintersFromScrollbars(verticalScrollbar, horizontalScrollbar);
    102102   
    103     node->setFrameScaleFactor(frameView->frame().frameScaleFactor());
    104     node->setHeaderHeight(frameView->headerHeight());
    105     node->setFooterHeight(frameView->footerHeight());
    106     node->setTopContentInset(frameView->topContentInset());
    107 
    108     node->setScrollOrigin(frameView->scrollOrigin());
    109     node->setScrollableAreaSize(frameView->visibleContentRect().size());
    110     node->setTotalContentsSize(frameView->totalContentsSize());
    111     node->setReachableContentsSize(frameView->totalContentsSize());
     103    node->setFrameScaleFactor(frameView.frame().frameScaleFactor());
     104    node->setHeaderHeight(frameView.headerHeight());
     105    node->setFooterHeight(frameView.footerHeight());
     106    node->setTopContentInset(frameView.topContentInset());
     107
     108    node->setScrollOrigin(frameView.scrollOrigin());
     109    node->setScrollableAreaSize(frameView.visibleContentRect().size());
     110    node->setTotalContentsSize(frameView.totalContentsSize());
     111    node->setReachableContentsSize(frameView.totalContentsSize());
    112112
    113113#if ENABLE(CSS_SCROLL_SNAP)
    114     frameView->updateSnapOffsets();
    115     if (const Vector<LayoutUnit>* horizontalSnapOffsets = frameView->horizontalSnapOffsets())
     114    frameView.updateSnapOffsets();
     115    if (const Vector<LayoutUnit>* horizontalSnapOffsets = frameView.horizontalSnapOffsets())
    116116        setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Horizontal, *horizontalSnapOffsets, m_page->deviceScaleFactor());
    117117
    118     if (const Vector<LayoutUnit>* verticalSnapOffsets = frameView->verticalSnapOffsets())
     118    if (const Vector<LayoutUnit>* verticalSnapOffsets = frameView.verticalSnapOffsets())
    119119        setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Vertical, *verticalSnapOffsets, m_page->deviceScaleFactor());
    120120#endif
    121121
    122122    ScrollableAreaParameters scrollParameters;
    123     scrollParameters.horizontalScrollElasticity = frameView->horizontalScrollElasticity();
    124     scrollParameters.verticalScrollElasticity = frameView->verticalScrollElasticity();
     123    scrollParameters.horizontalScrollElasticity = frameView.horizontalScrollElasticity();
     124    scrollParameters.verticalScrollElasticity = frameView.verticalScrollElasticity();
    125125    scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar && horizontalScrollbar->enabled();
    126126    scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar && verticalScrollbar->enabled();
    127     scrollParameters.horizontalScrollbarMode = frameView->horizontalScrollbarMode();
    128     scrollParameters.verticalScrollbarMode = frameView->verticalScrollbarMode();
     127    scrollParameters.horizontalScrollbarMode = frameView.horizontalScrollbarMode();
     128    scrollParameters.verticalScrollbarMode = frameView.verticalScrollbarMode();
    129129
    130130    node->setScrollableAreaParameters(scrollParameters);
    131131}
    132132
    133 void AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged(FrameView*)
     133void AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged(FrameView&)
    134134{
    135135    if (!m_scrollingStateTree->rootStateNode())
    136136        return;
    137137
    138     m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint()));
    139 }
    140 
    141 void AsyncScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView)
     138    m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint()));
     139}
     140
     141void AsyncScrollingCoordinator::frameViewRootLayerDidChange(FrameView& frameView)
    142142{
    143143    ASSERT(isMainThread());
     
    149149    // FIXME: In some navigation scenarios, the FrameView has no RenderView or that RenderView has not been composited.
    150150    // This needs cleaning up: https://bugs.webkit.org/show_bug.cgi?id=132724
    151     if (!frameView->scrollLayerID())
     151    if (!frameView.scrollLayerID())
    152152        return;
    153153   
     
    158158    ScrollingCoordinator::frameViewRootLayerDidChange(frameView);
    159159
    160     ScrollingStateFrameScrollingNode* node = downcast<ScrollingStateFrameScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
     160    ScrollingStateFrameScrollingNode* node = downcast<ScrollingStateFrameScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView.scrollLayerID()));
    161161    node->setLayer(scrollLayerForFrameView(frameView));
    162162    node->setScrolledContentsLayer(rootContentLayerForFrameView(frameView));
     
    166166    node->setHeaderLayer(headerLayerForFrameView(frameView));
    167167    node->setFooterLayer(footerLayerForFrameView(frameView));
    168     node->setScrollBehaviorForFixedElements(frameView->scrollBehaviorForFixedElements());
    169 }
    170 
    171 bool AsyncScrollingCoordinator::requestScrollPositionUpdate(FrameView* frameView, const IntPoint& scrollPosition)
     168    node->setScrollBehaviorForFixedElements(frameView.scrollBehaviorForFixedElements());
     169}
     170
     171bool AsyncScrollingCoordinator::requestScrollPositionUpdate(FrameView& frameView, const IntPoint& scrollPosition)
    172172{
    173173    ASSERT(isMainThread());
     
    177177        return false;
    178178
    179     bool isProgrammaticScroll = frameView->inProgrammaticScroll();
    180     if (isProgrammaticScroll || frameView->frame().document()->inPageCache())
    181         updateScrollPositionAfterAsyncScroll(frameView->scrollLayerID(), scrollPosition, isProgrammaticScroll, SetScrollingLayerPosition);
     179    bool isProgrammaticScroll = frameView.inProgrammaticScroll();
     180    if (isProgrammaticScroll || frameView.frame().document()->inPageCache())
     181        updateScrollPositionAfterAsyncScroll(frameView.scrollLayerID(), scrollPosition, isProgrammaticScroll, SetScrollingLayerPosition);
    182182
    183183    // If this frame view's document is being put into the page cache, we don't want to update our
    184184    // main frame scroll position. Just let the FrameView think that we did.
    185     if (frameView->frame().document()->inPageCache())
     185    if (frameView.frame().document()->inPageCache())
    186186        return true;
    187187
    188     ScrollingStateScrollingNode* stateNode = downcast<ScrollingStateScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
     188    ScrollingStateScrollingNode* stateNode = downcast<ScrollingStateScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView.scrollLayerID()));
    189189    if (!stateNode)
    190190        return false;
     
    263263        return;
    264264
    265     FrameView* frameView = frameViewForScrollingNode(scrollingNodeID);
    266     if (!frameView)
    267         return;
    268 
    269     if (scrollingNodeID == frameView->scrollLayerID()) {
    270         bool oldProgrammaticScroll = frameView->inProgrammaticScroll();
    271         frameView->setInProgrammaticScroll(programmaticScroll);
    272 
    273         frameView->setConstrainsScrollingToContentEdge(false);
    274         frameView->notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
    275         frameView->setConstrainsScrollingToContentEdge(true);
    276 
    277         frameView->setInProgrammaticScroll(oldProgrammaticScroll);
     265    FrameView* frameViewPtr = frameViewForScrollingNode(scrollingNodeID);
     266    if (!frameViewPtr)
     267        return;
     268
     269    FrameView& frameView = *frameViewPtr;
     270
     271    if (scrollingNodeID == frameView.scrollLayerID()) {
     272        bool oldProgrammaticScroll = frameView.inProgrammaticScroll();
     273        frameView.setInProgrammaticScroll(programmaticScroll);
     274
     275        frameView.setConstrainsScrollingToContentEdge(false);
     276        frameView.notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
     277        frameView.setConstrainsScrollingToContentEdge(true);
     278
     279        frameView.setInProgrammaticScroll(oldProgrammaticScroll);
    278280
    279281        if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
     
    284286            GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
    285287            GraphicsLayer* footerLayer = footerLayerForFrameView(frameView);
    286             LayoutSize scrollOffsetForFixed = frameView->scrollOffsetForFixedPosition();
    287 
    288             float topContentInset = frameView->topContentInset();
     288            LayoutSize scrollOffsetForFixed = frameView.scrollOffsetForFixedPosition();
     289
     290            float topContentInset = frameView.topContentInset();
    289291            FloatPoint positionForInsetClipLayer = FloatPoint(0, FrameView::yPositionForInsetClipLayer(scrollPosition, topContentInset));
    290292            FloatPoint positionForContentsLayer = FloatPoint(scrolledContentsLayer->position().x(),
    291                 FrameView::yPositionForRootContentLayer(scrollPosition, topContentInset, frameView->headerHeight()));
     293                FrameView::yPositionForRootContentLayer(scrollPosition, topContentInset, frameView.headerHeight()));
    292294            FloatPoint positionForHeaderLayer = FloatPoint(scrollOffsetForFixed.width(), FrameView::yPositionForHeaderLayer(scrollPosition, topContentInset));
    293295            FloatPoint positionForFooterLayer = FloatPoint(scrollOffsetForFixed.width(),
    294                 FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, frameView->totalContentsSize().height(), frameView->footerHeight()));
     296                FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, frameView.totalContentsSize().height(), frameView.footerHeight()));
    295297
    296298            if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) {
    297                 scrollLayer->setPosition(-frameView->scrollPosition());
     299                scrollLayer->setPosition(-frameView.scrollPosition());
    298300                if (counterScrollingLayer)
    299301                    counterScrollingLayer->setPosition(toLayoutPoint(scrollOffsetForFixed));
     
    309311                    footerLayer->setPosition(positionForFooterLayer);
    310312            } else {
    311                 scrollLayer->syncPosition(-frameView->scrollPosition());
     313                scrollLayer->syncPosition(-frameView.scrollPosition());
    312314                if (counterScrollingLayer)
    313315                    counterScrollingLayer->syncPosition(toLayoutPoint(scrollOffsetForFixed));
     
    323325                    footerLayer->syncPosition(positionForFooterLayer);
    324326
    325                 LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect();
     327                LayoutRect viewportRect = frameView.viewportConstrainedVisibleContentRect();
    326328                syncChildPositions(viewportRect);
    327329            }
     
    332334
    333335    // Overflow-scroll area.
    334     if (ScrollableArea* scrollableArea = frameView->scrollableAreaForScrollLayerID(scrollingNodeID)) {
     336    if (ScrollableArea* scrollableArea = frameView.scrollableAreaForScrollLayerID(scrollingNodeID)) {
    335337        scrollableArea->setIsUserScroll(scrollingLayerPositionAction == SyncScrollingLayerPosition);
    336338        scrollableArea->scrollToOffsetWithoutAnimation(scrollPosition);
     
    341343}
    342344
    343 void AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea* scrollableArea, ScrollbarOrientation orientation)
     345void AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea& scrollableArea, ScrollbarOrientation orientation)
    344346{
    345347    ASSERT(isMainThread());
    346348    ASSERT(m_page);
    347349
    348     if (scrollableArea != static_cast<ScrollableArea*>(m_page->mainFrame().view()))
     350    if (&scrollableArea != static_cast<ScrollableArea*>(m_page->mainFrame().view()))
    349351        return;
    350352
    351353    if (orientation == VerticalScrollbar)
    352         scrollableArea->verticalScrollbarLayerDidChange();
     354        scrollableArea.verticalScrollbarLayerDidChange();
    353355    else
    354         scrollableArea->horizontalScrollbarLayerDidChange();
     356        scrollableArea.horizontalScrollbarLayerDidChange();
    355357}
    356358
     
    384386}
    385387
    386 void AsyncScrollingCoordinator::ensureRootStateNodeForFrameView(FrameView* frameView)
    387 {
    388     ASSERT(frameView->scrollLayerID());
    389     attachToStateTree(FrameScrollingNode, frameView->scrollLayerID(), 0);
     388void AsyncScrollingCoordinator::ensureRootStateNodeForFrameView(FrameView& frameView)
     389{
     390    ASSERT(frameView.scrollLayerID());
     391    attachToStateTree(FrameScrollingNode, frameView.scrollLayerID(), 0);
    390392}
    391393
     
    482484        return;
    483485
    484     if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView))
     486    if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(*frameView))
    485487        scrollLayer->setPosition(-frameView->scrollPosition());
    486488}
    487489
    488 void AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView* frameView)
    489 {
    490     ScrollingStateFrameScrollingNode* node = downcast<ScrollingStateFrameScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
     490void AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView& frameView)
     491{
     492    ScrollingStateFrameScrollingNode* node = downcast<ScrollingStateFrameScrollingNode>(m_scrollingStateTree->stateNodeForID(frameView.scrollLayerID()));
    491493    if (!node)
    492494        return;
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h

    r180493 r182132  
    7474
    7575    virtual bool supportsFixedPositionLayers() const override { return true; }
    76     virtual bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const override { return false; }
     76    virtual bool hasVisibleSlowRepaintViewportConstrainedObjects(const FrameView&) const override { return false; }
    7777
    78     WEBCORE_EXPORT virtual void frameViewLayoutUpdated(FrameView*) override;
    79     WEBCORE_EXPORT virtual void frameViewRootLayerDidChange(FrameView*) override;
    80     WEBCORE_EXPORT virtual void frameViewNonFastScrollableRegionChanged(FrameView*) override;
     78    WEBCORE_EXPORT virtual void frameViewLayoutUpdated(FrameView&) override;
     79    WEBCORE_EXPORT virtual void frameViewRootLayerDidChange(FrameView&) override;
     80    WEBCORE_EXPORT virtual void frameViewNonFastScrollableRegionChanged(FrameView&) override;
    8181
    82     WEBCORE_EXPORT virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&) override;
     82    WEBCORE_EXPORT virtual bool requestScrollPositionUpdate(FrameView&, const IntPoint&) override;
    8383
    8484    WEBCORE_EXPORT virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID) override;
     
    9595
    9696    WEBCORE_EXPORT virtual void syncChildPositions(const LayoutRect& viewportRect) override;
    97     WEBCORE_EXPORT virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea*, ScrollbarOrientation) override;
     97    WEBCORE_EXPORT virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea&, ScrollbarOrientation) override;
    9898
    99     WEBCORE_EXPORT virtual void recomputeWheelEventHandlerCountForFrameView(FrameView*) override;
     99    WEBCORE_EXPORT virtual void recomputeWheelEventHandlerCountForFrameView(FrameView&) override;
    100100    WEBCORE_EXPORT virtual void setSynchronousScrollingReasons(SynchronousScrollingReasons) override;
    101101
    102102    virtual void scheduleTreeStateCommit() = 0;
    103103
    104     void ensureRootStateNodeForFrameView(FrameView*);
     104    void ensureRootStateNodeForFrameView(FrameView&);
    105105    void updateMainFrameScrollLayerPosition();
    106106
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r180474 r182132  
    8080{
    8181    ASSERT(m_page);
    82     m_page = 0;
    83 }
    84 
    85 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView) const
    86 {
    87     ASSERT(isMainThread());
    88     ASSERT(m_page);
    89 
    90     if (!frameView->frame().isMainFrame() && !m_page->settings().scrollingTreeIncludesFrames())
     82    m_page = nullptr;
     83}
     84
     85bool ScrollingCoordinator::coordinatesScrollingForFrameView(const FrameView& frameView) const
     86{
     87    ASSERT(isMainThread());
     88    ASSERT(m_page);
     89
     90    if (!frameView.frame().isMainFrame() && !m_page->settings().scrollingTreeIncludesFrames())
    9191        return false;
    9292
     
    9797}
    9898
    99 Region ScrollingCoordinator::computeNonFastScrollableRegion(const Frame* frame, const IntPoint& frameLocation) const
     99Region ScrollingCoordinator::computeNonFastScrollableRegion(const Frame& frame, const IntPoint& frameLocation) const
    100100{
    101101#if ENABLE(IOS_TOUCH_EVENTS)
     
    118118#else
    119119    Region nonFastScrollableRegion;
    120     FrameView* frameView = frame->view();
     120    FrameView* frameView = frame.view();
    121121    if (!frameView)
    122122        return nonFastScrollableRegion;
     
    146146    }
    147147
    148     for (Frame* subframe = frame->tree().firstChild(); subframe; subframe = subframe->tree().nextSibling())
    149         nonFastScrollableRegion.unite(computeNonFastScrollableRegion(subframe, offset));
     148    for (Frame* subframe = frame.tree().firstChild(); subframe; subframe = subframe->tree().nextSibling())
     149        nonFastScrollableRegion.unite(computeNonFastScrollableRegion(*subframe, offset));
    150150
    151151    return nonFastScrollableRegion;
     
    165165}
    166166
    167 void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView* frameView)
     167void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView& frameView)
    168168{
    169169    ASSERT(isMainThread());
     
    173173}
    174174
    175 void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* frameView)
     175void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView& frameView)
    176176{
    177177    ASSERT(isMainThread());
     
    184184}
    185185
    186 void ScrollingCoordinator::frameViewFixedObjectsDidChange(FrameView* frameView)
     186void ScrollingCoordinator::frameViewFixedObjectsDidChange(FrameView& frameView)
    187187{
    188188    ASSERT(isMainThread());
     
    195195}
    196196
    197 GraphicsLayer* ScrollingCoordinator::scrollLayerForScrollableArea(ScrollableArea* scrollableArea)
    198 {
    199     return scrollableArea->layerForScrolling();
    200 }
    201 
    202 GraphicsLayer* ScrollingCoordinator::scrollLayerForFrameView(FrameView* frameView)
    203 {
    204     if (RenderView* renderView = frameView->frame().contentRenderer())
     197GraphicsLayer* ScrollingCoordinator::scrollLayerForScrollableArea(ScrollableArea& scrollableArea)
     198{
     199    return scrollableArea.layerForScrolling();
     200}
     201
     202GraphicsLayer* ScrollingCoordinator::scrollLayerForFrameView(FrameView& frameView)
     203{
     204    if (RenderView* renderView = frameView.frame().contentRenderer())
    205205        return renderView->compositor().scrollLayer();
    206206    return nullptr;
    207207}
    208208
    209 GraphicsLayer* ScrollingCoordinator::headerLayerForFrameView(FrameView* frameView)
     209GraphicsLayer* ScrollingCoordinator::headerLayerForFrameView(FrameView& frameView)
    210210{
    211211#if ENABLE(RUBBER_BANDING)
    212     if (RenderView* renderView = frameView->frame().contentRenderer())
     212    if (RenderView* renderView = frameView.frame().contentRenderer())
    213213        return renderView->compositor().headerLayer();
    214214    return nullptr;
     
    219219}
    220220
    221 GraphicsLayer* ScrollingCoordinator::footerLayerForFrameView(FrameView* frameView)
     221GraphicsLayer* ScrollingCoordinator::footerLayerForFrameView(FrameView& frameView)
    222222{
    223223#if ENABLE(RUBBER_BANDING)
    224     if (RenderView* renderView = frameView->frame().contentRenderer())
     224    if (RenderView* renderView = frameView.frame().contentRenderer())
    225225        return renderView->compositor().footerLayer();
    226226    return nullptr;
     
    231231}
    232232
    233 GraphicsLayer* ScrollingCoordinator::counterScrollingLayerForFrameView(FrameView* frameView)
    234 {
    235     if (RenderView* renderView = frameView->frame().contentRenderer())
     233GraphicsLayer* ScrollingCoordinator::counterScrollingLayerForFrameView(FrameView& frameView)
     234{
     235    if (RenderView* renderView = frameView.frame().contentRenderer())
    236236        return renderView->compositor().fixedRootBackgroundLayer();
    237237    return nullptr;
    238238}
    239239
    240 GraphicsLayer* ScrollingCoordinator::insetClipLayerForFrameView(FrameView* frameView)
    241 {
    242     if (RenderView* renderView = frameView->frame().contentRenderer())
     240GraphicsLayer* ScrollingCoordinator::insetClipLayerForFrameView(FrameView& frameView)
     241{
     242    if (RenderView* renderView = frameView.frame().contentRenderer())
    243243        return renderView->compositor().clipLayer();
    244244    return nullptr;
    245245}
    246246
    247 GraphicsLayer* ScrollingCoordinator::contentShadowLayerForFrameView(FrameView* frameView)
     247GraphicsLayer* ScrollingCoordinator::contentShadowLayerForFrameView(FrameView& frameView)
    248248{
    249249#if ENABLE(RUBBER_BANDING)
    250     if (RenderView* renderView = frameView->frame().contentRenderer())
     250    if (RenderView* renderView = frameView.frame().contentRenderer())
    251251        return renderView->compositor().layerForContentShadow();
    252252   
     
    258258}
    259259
    260 GraphicsLayer* ScrollingCoordinator::rootContentLayerForFrameView(FrameView* frameView)
    261 {
    262     if (RenderView* renderView = frameView->frame().contentRenderer())
     260GraphicsLayer* ScrollingCoordinator::rootContentLayerForFrameView(FrameView& frameView)
     261{
     262    if (RenderView* renderView = frameView.frame().contentRenderer())
    263263        return renderView->compositor().rootContentLayer();
    264264    return nullptr;
    265265}
    266266
    267 void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView)
     267void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView& frameView)
    268268{
    269269    ASSERT(isMainThread());
     
    294294#endif
    295295
    296 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(FrameView* frameView) const
    297 {
    298     const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects();
     296bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(const FrameView& frameView) const
     297{
     298    const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView.viewportConstrainedObjects();
    299299    if (!viewportConstrainedObjects)
    300300        return false;
     
    312312}
    313313
    314 SynchronousScrollingReasons ScrollingCoordinator::synchronousScrollingReasons(FrameView* frameView) const
    315 {
    316     if (!frameView)
    317         return static_cast<SynchronousScrollingReasons>(0);
    318 
     314SynchronousScrollingReasons ScrollingCoordinator::synchronousScrollingReasons(const FrameView& frameView) const
     315{
    319316    SynchronousScrollingReasons synchronousScrollingReasons = (SynchronousScrollingReasons)0;
    320317
     
    326323        synchronousScrollingReasons |= ForcedOnMainThread;
    327324#endif
    328     if (frameView->hasSlowRepaintObjects())
     325    if (frameView.hasSlowRepaintObjects())
    329326        synchronousScrollingReasons |= HasSlowRepaintObjects;
    330     if (!supportsFixedPositionLayers() && frameView->hasViewportConstrainedObjects())
     327    if (!supportsFixedPositionLayers() && frameView.hasViewportConstrainedObjects())
    331328        synchronousScrollingReasons |= HasViewportConstrainedObjectsWithoutSupportingFixedLayers;
    332329    if (supportsFixedPositionLayers() && hasVisibleSlowRepaintViewportConstrainedObjects(frameView))
    333330        synchronousScrollingReasons |= HasNonLayerViewportConstrainedObjects;
    334     if (frameView->frame().mainFrame().document() && frameView->frame().document()->isImageDocument())
     331    if (frameView.frame().mainFrame().document() && frameView.frame().document()->isImageDocument())
    335332        synchronousScrollingReasons |= IsImageDocument;
    336333
     
    338335}
    339336
    340 void ScrollingCoordinator::updateSynchronousScrollingReasons(FrameView* frameView)
     337void ScrollingCoordinator::updateSynchronousScrollingReasons(FrameView& frameView)
    341338{
    342339    // FIXME: Once we support async scrolling of iframes, we'll have to track the synchronous scrolling
    343340    // reasons per frame (maybe on scrolling tree nodes).
    344     if (!frameView->frame().isMainFrame())
     341    if (!frameView.frame().isMainFrame())
    345342        return;
    346343
     
    354351
    355352    m_forceSynchronousScrollLayerPositionUpdates = forceSynchronousScrollLayerPositionUpdates;
    356     updateSynchronousScrollingReasons(m_page->mainFrame().view());
     353    if (FrameView* frameView = m_page->mainFrame().view())
     354        updateSynchronousScrollingReasons(*frameView);
    357355}
    358356
    359357bool ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously() const
    360358{
    361     return synchronousScrollingReasons(m_page->mainFrame().view());
     359    if (FrameView* frameView = m_page->mainFrame().view())
     360        return synchronousScrollingReasons(*frameView);
     361    return true;
    362362}
    363363
     
    366366{
    367367    // FIXME: Once we support async scrolling of iframes, this should go through all subframes.
    368     updateSynchronousScrollingReasons(m_page->mainFrame().view());
     368    if (FrameView* frameView = m_page->mainFrame().view())
     369        updateSynchronousScrollingReasons(*frameView);
    369370}
    370371#endif
     
    403404String ScrollingCoordinator::synchronousScrollingReasonsAsText() const
    404405{
    405     return synchronousScrollingReasonsAsText(synchronousScrollingReasons(m_page->mainFrame().view()));
     406    if (FrameView* frameView = m_page->mainFrame().view())
     407        return synchronousScrollingReasonsAsText(synchronousScrollingReasons(*frameView));
     408
     409    return String();
    406410}
    407411
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r175584 r182132  
    116116
    117117    // Return whether this scrolling coordinator handles scrolling for the given frame view.
    118     virtual bool coordinatesScrollingForFrameView(FrameView*) const;
     118    virtual bool coordinatesScrollingForFrameView(const FrameView&) const;
    119119
    120120    // Should be called whenever the given frame view has been laid out.
    121     virtual void frameViewLayoutUpdated(FrameView*) { }
     121    virtual void frameViewLayoutUpdated(FrameView&) { }
    122122
    123123    // Should be called whenever a wheel event handler is added or removed in the
    124124    // frame view's underlying document.
    125     void frameViewWheelEventHandlerCountChanged(FrameView*);
     125    void frameViewWheelEventHandlerCountChanged(FrameView&);
    126126
    127127    // Should be called whenever the slow repaint objects counter changes between zero and one.
    128     void frameViewHasSlowRepaintObjectsDidChange(FrameView*);
     128    void frameViewHasSlowRepaintObjectsDidChange(FrameView&);
    129129
    130130    // Should be called whenever the set of fixed objects changes.
    131     void frameViewFixedObjectsDidChange(FrameView*);
     131    void frameViewFixedObjectsDidChange(FrameView&);
    132132
    133133    // Called whenever the non-fast scrollable region changes for reasons other than layout.
    134     virtual void frameViewNonFastScrollableRegionChanged(FrameView*) { }
     134    virtual void frameViewNonFastScrollableRegionChanged(FrameView&) { }
    135135
    136136    // Should be called whenever the root layer for the given frame view changes.
    137     virtual void frameViewRootLayerDidChange(FrameView*);
     137    virtual void frameViewRootLayerDidChange(FrameView&);
    138138
    139139    // Return whether this scrolling coordinator can keep fixed position layers fixed to their
     
    157157    // Their meaningful implementations are in ScrollingCoordinatorMac.
    158158    virtual void commitTreeStateIfNeeded() { }
    159     virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&) { return false; }
    160     virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&) { return true; }
     159    virtual bool requestScrollPositionUpdate(FrameView&, const IntPoint&) { return false; }
     160    virtual bool handleWheelEvent(FrameView&, const PlatformWheelEvent&) { return true; }
    161161    virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID /*parentID*/) { return newNodeID; }
    162162    virtual void detachFromStateTree(ScrollingNodeID) { }
     
    187187
    188188    enum MainThreadScrollingReasonFlags {
    189         ForcedOnMainThread = 1 << 0,
    190         HasSlowRepaintObjects = 1 << 1,
    191         HasViewportConstrainedObjectsWithoutSupportingFixedLayers = 1 << 2,
    192         HasNonLayerViewportConstrainedObjects = 1 << 3,
    193         IsImageDocument = 1 << 4
     189        ForcedOnMainThread                                          = 1 << 0,
     190        HasSlowRepaintObjects                                       = 1 << 1,
     191        HasViewportConstrainedObjectsWithoutSupportingFixedLayers   = 1 << 2,
     192        HasNonLayerViewportConstrainedObjects                       = 1 << 3,
     193        IsImageDocument                                             = 1 << 4
    194194    };
    195195
    196     SynchronousScrollingReasons synchronousScrollingReasons(FrameView*) const;
     196    SynchronousScrollingReasons synchronousScrollingReasons(const FrameView&) const;
    197197    bool shouldUpdateScrollLayerPositionSynchronously() const;
    198198
    199     virtual void willDestroyScrollableArea(ScrollableArea*) { }
    200     virtual void scrollableAreaScrollLayerDidChange(ScrollableArea*) { }
    201     virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea*, ScrollbarOrientation) { }
     199    virtual void willDestroyScrollableArea(ScrollableArea&) { }
     200    virtual void scrollableAreaScrollLayerDidChange(ScrollableArea&) { }
     201    virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea&, ScrollbarOrientation) { }
    202202
    203203    static String synchronousScrollingReasonsAsText(SynchronousScrollingReasons);
    204204    String synchronousScrollingReasonsAsText() const;
    205205
    206     Region computeNonFastScrollableRegion(const Frame*, const IntPoint& frameLocation) const;
     206    Region computeNonFastScrollableRegion(const Frame&, const IntPoint& frameLocation) const;
    207207
    208208protected:
    209209    explicit ScrollingCoordinator(Page*);
    210210
    211     static GraphicsLayer* scrollLayerForScrollableArea(ScrollableArea*);
     211    static GraphicsLayer* scrollLayerForScrollableArea(ScrollableArea&);
    212212
    213213    unsigned computeCurrentWheelEventHandlerCount();
    214     GraphicsLayer* scrollLayerForFrameView(FrameView*);
    215     GraphicsLayer* counterScrollingLayerForFrameView(FrameView*);
    216     GraphicsLayer* insetClipLayerForFrameView(FrameView*);
    217     GraphicsLayer* rootContentLayerForFrameView(FrameView*);
    218     GraphicsLayer* contentShadowLayerForFrameView(FrameView*);
    219     GraphicsLayer* headerLayerForFrameView(FrameView*);
    220     GraphicsLayer* footerLayerForFrameView(FrameView*);
     214    GraphicsLayer* scrollLayerForFrameView(FrameView&);
     215    GraphicsLayer* counterScrollingLayerForFrameView(FrameView&);
     216    GraphicsLayer* insetClipLayerForFrameView(FrameView&);
     217    GraphicsLayer* rootContentLayerForFrameView(FrameView&);
     218    GraphicsLayer* contentShadowLayerForFrameView(FrameView&);
     219    GraphicsLayer* headerLayerForFrameView(FrameView&);
     220    GraphicsLayer* footerLayerForFrameView(FrameView&);
    221221
    222222    Page* m_page; // FIXME: ideally this would be a reference but it gets nulled on async teardown.
    223223
    224224private:
    225     virtual void recomputeWheelEventHandlerCountForFrameView(FrameView*) { }
     225    virtual void recomputeWheelEventHandlerCountForFrameView(FrameView&) { }
    226226    virtual void setSynchronousScrollingReasons(SynchronousScrollingReasons) { }
    227227
    228     virtual bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const;
    229     void updateSynchronousScrollingReasons(FrameView*);
     228    virtual bool hasVisibleSlowRepaintViewportConstrainedObjects(const FrameView&) const;
     229    void updateSynchronousScrollingReasons(FrameView&);
    230230   
    231231    bool m_forceSynchronousScrollLayerPositionUpdates;
  • trunk/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp

    r177840 r182132  
    9595}
    9696
    97 void ScrollingCoordinatorCoordinatedGraphics::scrollableAreaScrollLayerDidChange(ScrollableArea* scrollableArea)
     97void ScrollingCoordinatorCoordinatedGraphics::scrollableAreaScrollLayerDidChange(ScrollableArea& scrollableArea)
    9898{
    9999    CoordinatedGraphicsLayer* layer = toCoordinatedGraphicsLayer(scrollLayerForScrollableArea(scrollableArea));
     
    101101        return;
    102102
    103     layer->setScrollableArea(scrollableArea);
     103    layer->setScrollableArea(&scrollableArea);
    104104}
    105105
    106 void ScrollingCoordinatorCoordinatedGraphics::willDestroyScrollableArea(ScrollableArea* scrollableArea)
     106void ScrollingCoordinatorCoordinatedGraphics::willDestroyScrollableArea(ScrollableArea& scrollableArea)
    107107{
    108108    CoordinatedGraphicsLayer* layer = toCoordinatedGraphicsLayer(scrollLayerForScrollableArea(scrollableArea));
     
    113113}
    114114
    115 bool ScrollingCoordinatorCoordinatedGraphics::requestScrollPositionUpdate(FrameView* frameView, const IntPoint& scrollPosition)
     115bool ScrollingCoordinatorCoordinatedGraphics::requestScrollPositionUpdate(FrameView& frameView, const IntPoint& scrollPosition)
    116116{
    117     if (!frameView->delegatesScrolling())
     117    if (!frameView.delegatesScrolling())
    118118        return false;
    119119
    120     frameView->setFixedVisibleContentRect(IntRect(scrollPosition, frameView->visibleContentRect().size()));
    121     frameView->hostWindow()->delegatedScrollRequested(scrollPosition);
     120    frameView.setFixedVisibleContentRect(IntRect(scrollPosition, frameView.visibleContentRect().size()));
     121    frameView.hostWindow()->delegatedScrollRequested(scrollPosition);
    122122    return true;
    123123}
  • trunk/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h

    r177840 r182132  
    4848    virtual void updateViewportConstrainedNode(ScrollingNodeID, const ViewportConstraints&, GraphicsLayer*) override;
    4949
    50     virtual void scrollableAreaScrollLayerDidChange(ScrollableArea*) override;
    51     virtual void willDestroyScrollableArea(ScrollableArea*) override;
     50    virtual void scrollableAreaScrollLayerDidChange(ScrollableArea&) override;
     51    virtual void willDestroyScrollableArea(ScrollableArea&) override;
    5252
    53     virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&) override;
     53    virtual bool requestScrollPositionUpdate(FrameView&, const IntPoint&) override;
    5454
    5555private:
  • trunk/Source/WebCore/page/scrolling/ios/ScrollingCoordinatorIOS.h

    r176459 r182132  
    4949
    5050    // Handle the wheel event on the scrolling thread. Returns whether the event was handled or not.
    51     virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&) override { return false; }
     51    virtual bool handleWheelEvent(FrameView&, const PlatformWheelEvent&) override { return false; }
    5252
    5353private:
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h

    r176459 r182132  
    4949
    5050    // Handle the wheel event on the scrolling thread. Returns whether the event was handled or not.
    51     virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&) override;
     51    virtual bool handleWheelEvent(FrameView&, const PlatformWheelEvent&) override;
    5252
    5353private:
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm

    r177848 r182132  
    8787}
    8888
    89 bool ScrollingCoordinatorMac::handleWheelEvent(FrameView*, const PlatformWheelEvent& wheelEvent)
     89bool ScrollingCoordinatorMac::handleWheelEvent(FrameView&, const PlatformWheelEvent& wheelEvent)
    9090{
    9191    ASSERT(isMainThread());
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r182116 r182132  
    361361    if (renderer().frame().page()) {
    362362        if (ScrollingCoordinator* scrollingCoordinator = renderer().frame().page()->scrollingCoordinator())
    363             scrollingCoordinator->willDestroyScrollableArea(this);
     363            scrollingCoordinator->willDestroyScrollableArea(*this);
    364364    }
    365365
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r181832 r182132  
    12961296    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
    12971297        if (horizontalScrollbarLayerChanged)
    1298             scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(&m_owningLayer, HorizontalScrollbar);
     1298            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer, HorizontalScrollbar);
    12991299        if (verticalScrollbarLayerChanged)
    1300             scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(&m_owningLayer, VerticalScrollbar);
     1300            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer, VerticalScrollbar);
    13011301    }
    13021302
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r181832 r182132  
    988988                updateScrollCoordinatedStatus(layer);
    989989                if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    990                     scrollingCoordinator->frameViewRootLayerDidChange(&m_renderView.frameView());
     990                    scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
    991991#if ENABLE(RUBBER_BANDING)
    992992                if (Page* page = this->page()) {
     
    10621062        if (layerChanged) {
    10631063            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    1064                 scrollingCoordinator->frameViewFixedObjectsDidChange(&m_renderView.frameView());
     1064                scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView.frameView());
    10651065        }
    10661066    } else
     
    17081708{
    17091709    ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
    1710     return scrollingCoordinator && scrollingCoordinator->coordinatesScrollingForFrameView(&m_renderView.frameView());
     1710    return scrollingCoordinator && scrollingCoordinator->coordinatesScrollingForFrameView(m_renderView.frameView());
    17111711}
    17121712
     
    17671767{
    17681768    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    1769         scrollingCoordinator->scrollableAreaScrollLayerDidChange(&layer);
     1769        scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer);
    17701770}
    17711771
     
    31133113            // by the header layer, so if we remove the header, we need to tell the scrolling tree.
    31143114            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    3115                 scrollingCoordinator->frameViewRootLayerDidChange(&m_renderView.frameView());
     3115                scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
    31163116        }
    31173117        return 0;
     
    31333133
    31343134    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    3135         scrollingCoordinator->frameViewRootLayerDidChange(&m_renderView.frameView());
     3135        scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
    31363136
    31373137    if (Page* page = this->page())
     
    31543154            // by the footer layer, so if we remove the footer, we need to tell the scrolling tree.
    31553155            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    3156                 scrollingCoordinator->frameViewRootLayerDidChange(&m_renderView.frameView());
     3156                scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
    31573157        }
    31583158        return 0;
     
    31743174
    31753175    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    3176         scrollingCoordinator->frameViewRootLayerDidChange(&m_renderView.frameView());
     3176        scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
    31773177
    31783178    if (Page* page = this->page())
     
    32883288
    32893289            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    3290                 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(&m_renderView.frameView(), HorizontalScrollbar);
     3290                scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), HorizontalScrollbar);
    32913291        }
    32923292    } else if (m_layerForHorizontalScrollbar) {
     
    32953295
    32963296        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    3297             scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(&m_renderView.frameView(), HorizontalScrollbar);
     3297            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), HorizontalScrollbar);
    32983298    }
    32993299
     
    33113311
    33123312            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    3313                 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(&m_renderView.frameView(), VerticalScrollbar);
     3313                scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), VerticalScrollbar);
    33143314        }
    33153315    } else if (m_layerForVerticalScrollbar) {
     
    33183318
    33193319        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    3320             scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(&m_renderView.frameView(), VerticalScrollbar);
     3320            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), VerticalScrollbar);
    33213321    }
    33223322
     
    34383438        m_layerForHorizontalScrollbar = nullptr;
    34393439        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    3440             scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(&m_renderView.frameView(), HorizontalScrollbar);
     3440            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), HorizontalScrollbar);
    34413441        if (Scrollbar* horizontalScrollbar = m_renderView.frameView().verticalScrollbar())
    34423442            m_renderView.frameView().invalidateScrollbar(horizontalScrollbar, IntRect(IntPoint(0, 0), horizontalScrollbar->frameRect().size()));
     
    34473447        m_layerForVerticalScrollbar = nullptr;
    34483448        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    3449             scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(&m_renderView.frameView(), VerticalScrollbar);
     3449            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_renderView.frameView(), VerticalScrollbar);
    34503450        if (Scrollbar* verticalScrollbar = m_renderView.frameView().verticalScrollbar())
    34513451            m_renderView.frameView().invalidateScrollbar(verticalScrollbar, IntRect(IntPoint(0, 0), verticalScrollbar->frameRect().size()));
     
    38173817{
    38183818    ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
    3819     ASSERT(scrollingCoordinator->coordinatesScrollingForFrameView(&m_renderView.frameView()));
     3819    ASSERT(scrollingCoordinator->coordinatesScrollingForFrameView(m_renderView.frameView()));
    38203820
    38213821    ScrollingNodeID nodeID = attachScrollingNode(*m_renderView.layer(), FrameScrollingNode, parentNodeID);
     
    38263826{
    38273827    ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
    3828     if (!scrollingCoordinator || !scrollingCoordinator->coordinatesScrollingForFrameView(&m_renderView.frameView()))
     3828    if (!scrollingCoordinator || !scrollingCoordinator->coordinatesScrollingForFrameView(m_renderView.frameView()))
    38293829        return;
    38303830
     
    40204020
    40214021        // For Coordinated Graphics.
    4022         scrollingCoordinator->scrollableAreaScrollLayerDidChange(&layer);
     4022        scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer);
    40234023        return;
    40244024    }
     
    40454045    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) {
    40464046        // For Coordinated Graphics.
    4047         scrollingCoordinator->scrollableAreaScrollLayerDidChange(&layer);
     4047        scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer);
    40484048        return;
    40494049    }
  • trunk/Source/WebCore/testing/Internals.cpp

    r182038 r182132  
    17721772        return nullptr;
    17731773
    1774     return page->nonFastScrollableRects(document->frame());
     1774    return page->nonFastScrollableRects(*document->frame());
    17751775}
    17761776
  • trunk/Source/WebKit2/ChangeLog

    r182126 r182132  
     12015-03-29  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Convert arguments to ScrollingCoordinator functions to references
     4        https://bugs.webkit.org/show_bug.cgi?id=143198
     5
     6        Reviewed by Darin Adler.
     7
     8        Convert all the FrameView* and ScrollableArea* arguments to ScrollingCoordinator functions to
     9        references, and use references in a few other places.
     10
     11        * WebProcess/Scrolling/RemoteScrollingCoordinator.h:
     12        * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
     13        (WebKit::RemoteScrollingCoordinator::coordinatesScrollingForFrameView):
     14
    1152015-03-29  Enrica Casucci  <enrica@apple.com>
    216
  • trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h

    r177917 r182132  
    6262   
    6363    // ScrollingCoordinator
    64     virtual bool coordinatesScrollingForFrameView(WebCore::FrameView*) const override;
     64    virtual bool coordinatesScrollingForFrameView(const WebCore::FrameView&) const override;
    6565    virtual void scheduleTreeStateCommit() override;
    6666
  • trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm

    r179409 r182132  
    6868}
    6969
    70 bool RemoteScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView) const
     70bool RemoteScrollingCoordinator::coordinatesScrollingForFrameView(const FrameView& frameView) const
    7171{
    72     RenderView* renderView = frameView->renderView();
     72    RenderView* renderView = frameView.renderView();
    7373    return renderView && renderView->usesCompositing();
    7474}
Note: See TracChangeset for help on using the changeset viewer.