Changeset 162736 in webkit


Ignore:
Timestamp:
Jan 24, 2014 4:04:18 PM (10 years ago)
Author:
Simon Fraser
Message:

Prepare scrolling tree to handle > 1 scrolling node
https://bugs.webkit.org/show_bug.cgi?id=127590

Source/WebCore:

Reviewed by Tim Horton.

Clean up the code path called after the ScrollingTree has scrolled a node,
to prepare for multiple scrolling nodes.

Change "updateMainFrameScrollPosition" terminology to "updateScrollPositionAfterAsyncScroll",
and pass along the ScrollingNodeID that scrolled.

Move updateMainFrameScrollPosition-related code from ScrollingCoordinator to
AsyncScrollingCoordinator, since this sync-up is only necessary when doing
async scrolling.

  • WebCore.exp.in:
  • page/scrolling/AsyncScrollingCoordinator.cpp:

(WebCore::AsyncScrollingCoordinator::AsyncScrollingCoordinator):
(WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
(WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):

  • page/scrolling/AsyncScrollingCoordinator.h:

(WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate):
(WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::matchesUpdateType):
Package up the data related to a scheduled scroll into a ScheduledScrollUpdate struct,
for easier comparison and cleaner code.

  • page/scrolling/ScrollingCoordinator.cpp:

(WebCore::ScrollingCoordinator::ScrollingCoordinator):

  • page/scrolling/ScrollingCoordinator.h:
  • page/scrolling/ScrollingTree.h:
  • page/scrolling/ThreadedScrollingTree.cpp:

(WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):

  • page/scrolling/ThreadedScrollingTree.h:
  • page/scrolling/ios/ScrollingTreeIOS.cpp:

(WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll):

  • page/scrolling/ios/ScrollingTreeIOS.h:
  • page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm:

(WebCore::ScrollingTreeScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints):

  • page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:

(WebCore::ScrollingTreeScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):

Source/WebKit2:

Reviewed by Tim Horton.

Clean up the code path called after the ScrollingTree has scrolled a node,
to prepare for multiple scrolling nodes.

Change "updateMainFrameScrollPosition" terminology to "updateScrollPositionAfterAsyncScroll",
and pass along the ScrollingNodeID that scrolled.

  • UIProcess/Scrolling/RemoteScrollingTree.cpp:

(WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):

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

(WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode):

Location:
trunk/Source
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r162735 r162736  
     12014-01-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Prepare scrolling tree to handle > 1 scrolling node
     4        https://bugs.webkit.org/show_bug.cgi?id=127590
     5
     6        Reviewed by Tim Horton.
     7
     8        Clean up the code path called after the ScrollingTree has scrolled a node,
     9        to prepare for multiple scrolling nodes.
     10       
     11        Change "updateMainFrameScrollPosition" terminology to "updateScrollPositionAfterAsyncScroll",
     12        and pass along the ScrollingNodeID that scrolled.
     13       
     14        Move updateMainFrameScrollPosition-related code from ScrollingCoordinator to
     15        AsyncScrollingCoordinator, since this sync-up is only necessary when doing
     16        async scrolling.
     17
     18        * WebCore.exp.in:
     19        * page/scrolling/AsyncScrollingCoordinator.cpp:
     20        (WebCore::AsyncScrollingCoordinator::AsyncScrollingCoordinator):
     21        (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
     22        (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
     23        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
     24        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
     25        * page/scrolling/AsyncScrollingCoordinator.h:
     26        (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate):
     27        (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::matchesUpdateType):
     28        Package up the data related to a scheduled scroll into a ScheduledScrollUpdate struct,
     29        for easier comparison and cleaner code.
     30        * page/scrolling/ScrollingCoordinator.cpp:
     31        (WebCore::ScrollingCoordinator::ScrollingCoordinator):
     32        * page/scrolling/ScrollingCoordinator.h:
     33        * page/scrolling/ScrollingTree.h:
     34        * page/scrolling/ThreadedScrollingTree.cpp:
     35        (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
     36        * page/scrolling/ThreadedScrollingTree.h:
     37        * page/scrolling/ios/ScrollingTreeIOS.cpp:
     38        (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll):
     39        * page/scrolling/ios/ScrollingTreeIOS.h:
     40        * page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm:
     41        (WebCore::ScrollingTreeScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints):
     42        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
     43        (WebCore::ScrollingTreeScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
     44
    1452014-01-24  Mark Lam  <mark.lam@apple.com>
    246
  • trunk/Source/WebCore/WebCore.exp.in

    r162725 r162736  
    29932993__ZN7WebCore23ScrollingTreeStickyNode6createERNS_13ScrollingTreeEy
    29942994__ZN7WebCore24ScrollingStateStickyNode17updateConstraintsERKNS_33StickyPositionViewportConstraintsE
    2995 __ZN7WebCore20ScrollingCoordinator35scheduleUpdateScrollPositionForNodeEyRKNS_8IntPointEbNS_31SetOrSyncScrollingLayerPositionE
    29962995__ZN7WebCore25AsyncScrollingCoordinator14clearStateTreeEv
    29972996__ZN7WebCore25AsyncScrollingCoordinator17attachToStateTreeENS_17ScrollingNodeTypeEyy
     
    30073006__ZN7WebCore25AsyncScrollingCoordinator37scrollableAreaScrollbarLayerDidChangeEPNS_14ScrollableAreaENS_20ScrollbarOrientationE
    30083007__ZN7WebCore25AsyncScrollingCoordinator43recomputeWheelEventHandlerCountForFrameViewEPNS_9FrameViewE
     3008__ZN7WebCore25AsyncScrollingCoordinator44scheduleUpdateScrollPositionAfterAsyncScrollEyRKNS_8IntPointEbNS_31SetOrSyncScrollingLayerPositionE
    30093009__ZN7WebCore25AsyncScrollingCoordinatorC2EPNS_4PageE
    30103010__ZN7WebCore25AsyncScrollingCoordinatorD2Ev
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r161306 r162736  
    4444AsyncScrollingCoordinator::AsyncScrollingCoordinator(Page* page)
    4545    : ScrollingCoordinator(page)
     46    , m_updateNodeScrollPositionTimer(this, &AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired)
    4647    , m_scrollingStateTree(ScrollingStateTree::create(this))
    4748{
     
    136137
    137138    if (frameView->inProgrammaticScroll() || frameView->frame().document()->inPageCache())
    138         updateMainFrameScrollPosition(scrollPosition, frameView->inProgrammaticScroll(), SetScrollingLayerPosition);
     139        updateScrollPositionAfterAsyncScroll(frameView->scrollLayerID(), scrollPosition, frameView->inProgrammaticScroll(), SetScrollingLayerPosition);
    139140
    140141    // If this frame view's document is being put into the page cache, we don't want to update our
     
    149150    stateNode->setRequestedScrollPosition(scrollPosition, frameView->inProgrammaticScroll());
    150151    return true;
     152}
     153
     154void AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll(ScrollingNodeID nodeID, const IntPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
     155{
     156    ScheduledScrollUpdate scrollUpdate(nodeID, scrollPosition, programmaticScroll, scrollingLayerPositionAction);
     157   
     158    if (m_updateNodeScrollPositionTimer.isActive()) {
     159        if (m_scheduledScrollUpdate.matchesUpdateType(scrollUpdate)) {
     160            m_scheduledScrollUpdate.scrollPosition = scrollPosition;
     161            return;
     162        }
     163   
     164        // If the parameters don't match what was previosly scheduled, dispatch immediately.
     165        m_updateNodeScrollPositionTimer.stop();
     166        updateScrollPositionAfterAsyncScroll(m_scheduledScrollUpdate.nodeID, m_scheduledScrollUpdate.scrollPosition, m_scheduledScrollUpdate.isProgrammaticScroll, m_scheduledScrollUpdate.updateLayerPositionAction);
     167        updateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, programmaticScroll, scrollingLayerPositionAction);
     168        return;
     169    }
     170
     171    m_scheduledScrollUpdate = scrollUpdate;
     172    m_updateNodeScrollPositionTimer.startOneShot(0);
     173}
     174
     175void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired(Timer<AsyncScrollingCoordinator>*)
     176{
     177    updateScrollPositionAfterAsyncScroll(m_scheduledScrollUpdate.nodeID, m_scheduledScrollUpdate.scrollPosition, m_scheduledScrollUpdate.isProgrammaticScroll, m_scheduledScrollUpdate.updateLayerPositionAction);
     178}
     179
     180void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const IntPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
     181{
     182    ASSERT(isMainThread());
     183
     184    if (!m_page)
     185        return;
     186
     187    FrameView* frameView = m_page->mainFrame().view();
     188    if (!frameView)
     189        return;
     190
     191    bool oldProgrammaticScroll = frameView->inProgrammaticScroll();
     192    frameView->setInProgrammaticScroll(programmaticScroll);
     193
     194    frameView->setConstrainsScrollingToContentEdge(false);
     195    frameView->notifyScrollPositionChanged(scrollPosition);
     196    frameView->setConstrainsScrollingToContentEdge(true);
     197
     198    frameView->setInProgrammaticScroll(oldProgrammaticScroll);
     199
     200#if USE(ACCELERATED_COMPOSITING)
     201    if (scrollingNodeID == frameView->scrollLayerID()) {
     202        if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
     203            GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
     204            GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
     205            GraphicsLayer* footerLayer = footerLayerForFrameView(frameView);
     206            IntSize scrollOffsetForFixed = frameView->scrollOffsetForFixedPosition();
     207
     208            if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) {
     209                scrollLayer->setPosition(-frameView->scrollPosition());
     210                if (counterScrollingLayer)
     211                    counterScrollingLayer->setPosition(IntPoint(scrollOffsetForFixed));
     212                if (headerLayer)
     213                    headerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), 0));
     214                if (footerLayer)
     215                    footerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), frameView->totalContentsSize().height() - frameView->footerHeight()));
     216            } else {
     217                scrollLayer->syncPosition(-frameView->scrollPosition());
     218                if (counterScrollingLayer)
     219                    counterScrollingLayer->syncPosition(IntPoint(scrollOffsetForFixed));
     220                if (headerLayer)
     221                    headerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), 0));
     222                if (footerLayer)
     223                    footerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), frameView->totalContentsSize().height() - frameView->footerHeight()));
     224
     225                LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect();
     226                syncChildPositions(viewportRect);
     227            }
     228        }
     229    }
     230    // FIXME: handle non-main scrolling nodes.
     231#else
     232    UNUSED_PARAM(scrollingLayerPositionAction);
     233#endif
    151234}
    152235
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h

    r162139 r162736  
    3232
    3333#include "ScrollingTree.h"
     34#include "Timer.h"
    3435#include <wtf/OwnPtr.h>
    3536#include <wtf/PassRefPtr.h>
     
    5758    void scrollingStateTreePropertiesChanged();
    5859
     60    void scheduleUpdateScrollPositionAfterAsyncScroll(ScrollingNodeID, const IntPoint&, bool programmaticScroll, SetOrSyncScrollingLayerPosition);
     61
    5962protected:
    6063    AsyncScrollingCoordinator(Page*);
     
    6568
    6669    PassRefPtr<ScrollingTree> releaseScrollingTree() { return m_scrollingTree.release(); }
     70
     71    void updateScrollPositionAfterAsyncScroll(ScrollingNodeID, const IntPoint&, bool programmaticScroll, SetOrSyncScrollingLayerPosition);
    6772
    6873private:
     
    108113    void setScrollbarPaintersFromScrollbarsForNode(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar, ScrollingStateScrollingNode*);
    109114
     115    void updateScrollPositionAfterAsyncScrollTimerFired(Timer<AsyncScrollingCoordinator>*);
     116
     117    Timer<AsyncScrollingCoordinator> m_updateNodeScrollPositionTimer;
     118
     119    struct ScheduledScrollUpdate {
     120        ScheduledScrollUpdate()
     121            : nodeID(0)
     122            , isProgrammaticScroll(false)
     123            , updateLayerPositionAction(SyncScrollingLayerPosition)
     124        { }
     125
     126        ScheduledScrollUpdate(ScrollingNodeID scrollingNodeID, IntPoint point, bool isProgrammatic, SetOrSyncScrollingLayerPosition udpateAction)
     127            : nodeID(scrollingNodeID)
     128            , scrollPosition(point)
     129            , isProgrammaticScroll(isProgrammatic)
     130            , updateLayerPositionAction(udpateAction)
     131        { }
     132
     133        ScrollingNodeID nodeID;
     134        IntPoint scrollPosition;
     135        bool isProgrammaticScroll;
     136        SetOrSyncScrollingLayerPosition updateLayerPositionAction;
     137       
     138        bool matchesUpdateType(const ScheduledScrollUpdate& other) const
     139        {
     140            return nodeID == other.nodeID
     141                && isProgrammaticScroll == other.isProgrammaticScroll
     142                && updateLayerPositionAction == other.updateLayerPositionAction;
     143        }
     144    };
     145
     146    ScheduledScrollUpdate m_scheduledScrollUpdate;
     147
    110148    OwnPtr<ScrollingStateTree> m_scrollingStateTree;
    111149    RefPtr<ScrollingTree> m_scrollingTree;
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r161662 r162736  
    6565ScrollingCoordinator::ScrollingCoordinator(Page* page)
    6666    : m_page(page)
    67     , m_updateMainFrameScrollPositionTimer(this, &ScrollingCoordinator::updateMainFrameScrollPositionTimerFired)
    68     , m_scheduledUpdateIsProgrammaticScroll(false)
    69     , m_scheduledScrollingLayerPositionAction(SyncScrollingLayerPosition)
    7067    , m_forceSynchronousScrollLayerPositionUpdates(false)
    7168{
     
    259256    recomputeWheelEventHandlerCountForFrameView(frameView);
    260257    updateSynchronousScrollingReasons();
    261 }
    262 
    263 void ScrollingCoordinator::scheduleUpdateScrollPositionForNode(ScrollingNodeID, const IntPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
    264 {
    265     // FIXME: need to handle non-main nodes.
    266     scheduleUpdateMainFrameScrollPosition(scrollPosition, programmaticScroll, scrollingLayerPositionAction);
    267 }
    268 
    269 void ScrollingCoordinator::scheduleUpdateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
    270 {
    271     if (m_updateMainFrameScrollPositionTimer.isActive()) {
    272         if (m_scheduledUpdateIsProgrammaticScroll == programmaticScroll
    273             && m_scheduledScrollingLayerPositionAction == scrollingLayerPositionAction) {
    274             m_scheduledUpdateScrollPosition = scrollPosition;
    275             return;
    276         }
    277    
    278         // If the parameters don't match what was previosly scheduled, dispatch immediately.
    279         m_updateMainFrameScrollPositionTimer.stop();
    280         updateMainFrameScrollPosition(m_scheduledUpdateScrollPosition, m_scheduledUpdateIsProgrammaticScroll, m_scheduledScrollingLayerPositionAction);
    281         updateMainFrameScrollPosition(scrollPosition, programmaticScroll, scrollingLayerPositionAction);
    282         return;
    283     }
    284 
    285     m_scheduledUpdateScrollPosition = scrollPosition;
    286     m_scheduledUpdateIsProgrammaticScroll = programmaticScroll;
    287     m_scheduledScrollingLayerPositionAction = scrollingLayerPositionAction;
    288     m_updateMainFrameScrollPositionTimer.startOneShot(0);
    289 }
    290 
    291 void ScrollingCoordinator::updateMainFrameScrollPositionTimerFired(Timer<ScrollingCoordinator>*)
    292 {
    293     updateMainFrameScrollPosition(m_scheduledUpdateScrollPosition, m_scheduledUpdateIsProgrammaticScroll, m_scheduledScrollingLayerPositionAction);
    294 }
    295 
    296 void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
    297 {
    298     ASSERT(isMainThread());
    299 
    300     if (!m_page)
    301         return;
    302 
    303     FrameView* frameView = m_page->mainFrame().view();
    304     if (!frameView)
    305         return;
    306 
    307     bool oldProgrammaticScroll = frameView->inProgrammaticScroll();
    308     frameView->setInProgrammaticScroll(programmaticScroll);
    309 
    310     frameView->setConstrainsScrollingToContentEdge(false);
    311     frameView->notifyScrollPositionChanged(scrollPosition);
    312     frameView->setConstrainsScrollingToContentEdge(true);
    313 
    314     frameView->setInProgrammaticScroll(oldProgrammaticScroll);
    315 
    316 #if USE(ACCELERATED_COMPOSITING)
    317     if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
    318         GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
    319         GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
    320         GraphicsLayer* footerLayer = footerLayerForFrameView(frameView);
    321         IntSize scrollOffsetForFixed = frameView->scrollOffsetForFixedPosition();
    322 
    323         if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) {
    324             scrollLayer->setPosition(-frameView->scrollPosition());
    325             if (counterScrollingLayer)
    326                 counterScrollingLayer->setPosition(IntPoint(scrollOffsetForFixed));
    327             if (headerLayer)
    328                 headerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), 0));
    329             if (footerLayer)
    330                 footerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), frameView->totalContentsSize().height() - frameView->footerHeight()));
    331         } else {
    332             scrollLayer->syncPosition(-frameView->scrollPosition());
    333             if (counterScrollingLayer)
    334                 counterScrollingLayer->syncPosition(IntPoint(scrollOffsetForFixed));
    335             if (headerLayer)
    336                 headerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), 0));
    337             if (footerLayer)
    338                 footerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), frameView->totalContentsSize().height() - frameView->footerHeight()));
    339 
    340             LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect();
    341             syncChildPositions(viewportRect);
    342         }
    343     }
    344 #else
    345     UNUSED_PARAM(scrollingLayerPositionAction);
    346 #endif
    347258}
    348259
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r161373 r162736  
    3232#include "RenderObject.h"
    3333#include "ScrollTypes.h"
    34 #include "Timer.h"
    3534#include <wtf/Forward.h>
    3635
     
    160159    ScrollingNodeID uniqueScrollLayerID();
    161160
    162     void scheduleUpdateScrollPositionForNode(ScrollingNodeID, const IntPoint&, bool programmaticScroll, SetOrSyncScrollingLayerPosition);
    163 
    164     // Dispatched by the scrolling tree whenever the main frame scroll position changes.
    165     void scheduleUpdateMainFrameScrollPosition(const IntPoint&, bool programmaticScroll, SetOrSyncScrollingLayerPosition);
    166     void updateMainFrameScrollPosition(const IntPoint&, bool programmaticScroll, SetOrSyncScrollingLayerPosition);
    167 
    168161    enum MainThreadScrollingReasonFlags {
    169162        ForcedOnMainThread = 1 << 0,
     
    211204    void updateSynchronousScrollingReasons();
    212205   
    213     void updateMainFrameScrollPositionTimerFired(Timer<ScrollingCoordinator>*);
    214 
    215     Timer<ScrollingCoordinator> m_updateMainFrameScrollPositionTimer;
    216     IntPoint m_scheduledUpdateScrollPosition;
    217     bool m_scheduledUpdateIsProgrammaticScroll;
    218     SetOrSyncScrollingLayerPosition m_scheduledScrollingLayerPositionAction;
    219 
    220206    bool m_forceSynchronousScrollLayerPositionUpdates;
    221207};
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.h

    r162731 r162736  
    7272    void setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom);
    7373
    74     virtual void updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) = 0;
     74    virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) = 0;
    7575    IntPoint mainFrameScrollPosition();
    7676
  • trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp

    r162731 r162736  
    101101}
    102102
    103 void ThreadedScrollingTree::updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
     103void ThreadedScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
    104104{
    105105    if (!m_scrollingCoordinator)
    106106        return;
    107107
    108     setMainFrameScrollPosition(scrollPosition);
     108    if (nodeID == rootNode()->scrollingNodeID())
     109        setMainFrameScrollPosition(scrollPosition);
    109110
    110     callOnMainThread(bind(&ScrollingCoordinator::scheduleUpdateMainFrameScrollPosition, m_scrollingCoordinator.get(), scrollPosition, isHandlingProgrammaticScroll(), scrollingLayerPositionAction));
     111    callOnMainThread(bind(&AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll, m_scrollingCoordinator.get(), nodeID, scrollPosition, isHandlingProgrammaticScroll(), scrollingLayerPositionAction));
    111112}
    112113
  • trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h

    r162731 r162736  
    6565    virtual PassOwnPtr<ScrollingTreeNode> createNode(ScrollingNodeType, ScrollingNodeID) override;
    6666
    67     virtual void updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) override;
     67    virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) override;
    6868#if PLATFORM(MAC) && !PLATFORM(IOS)
    6969    virtual void handleWheelEventPhase(PlatformWheelEventPhase) override;
  • trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp

    r161610 r162736  
    8282}
    8383
    84 void ScrollingTreeIOS::updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
     84void ScrollingTreeIOS::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
    8585{
    8686    if (!m_scrollingCoordinator)
    8787        return;
    8888
    89     setMainFrameScrollPosition(scrollPosition);
     89    if (nodeID == rootNode()->scrollingNodeID())
     90        setMainFrameScrollPosition(scrollPosition);
    9091
    91     callOnMainThread(bind(&ScrollingCoordinator::scheduleUpdateMainFrameScrollPosition, m_scrollingCoordinator.get(), scrollPosition, isHandlingProgrammaticScroll(), scrollingLayerPositionAction));
     92    callOnMainThread(bind(&AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll, m_scrollingCoordinator.get(), nodeID, scrollPosition, isHandlingProgrammaticScroll(), scrollingLayerPositionAction));
    9293}
    9394
  • trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h

    r162731 r162736  
    5757    virtual PassOwnPtr<ScrollingTreeNode> createNode(ScrollingNodeType, ScrollingNodeID) override;
    5858
    59     virtual void updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) override;
     59    virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) override;
    6060
    6161    RefPtr<AsyncScrollingCoordinator> m_scrollingCoordinator;
  • trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm

    r161610 r162736  
    119119    if (shouldUpdateScrollLayerPositionSynchronously()) {
    120120        m_probableMainThreadScrollPosition = scrollPosition;
    121         scrollingTree().updateMainFrameScrollPosition(scrollPosition, SetScrollingLayerPosition);
     121        scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, SetScrollingLayerPosition);
    122122        return;
    123123    }
    124124
    125125    setScrollLayerPosition(scrollPosition);
    126     scrollingTree().updateMainFrameScrollPosition(scrollPosition);
     126    scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition);
    127127}
    128128
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm

    r161303 r162736  
    316316    if (shouldUpdateScrollLayerPositionSynchronously()) {
    317317        m_probableMainThreadScrollPosition = scrollPosition;
    318         scrollingTree().updateMainFrameScrollPosition(scrollPosition, SetScrollingLayerPosition);
     318        scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, SetScrollingLayerPosition);
    319319        return;
    320320    }
    321321
    322322    setScrollLayerPosition(scrollPosition);
    323     scrollingTree().updateMainFrameScrollPosition(scrollPosition);
     323    scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition);
    324324}
    325325
  • trunk/Source/WebKit2/ChangeLog

    r162731 r162736  
     12014-01-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Prepare scrolling tree to handle > 1 scrolling node
     4        https://bugs.webkit.org/show_bug.cgi?id=127590
     5
     6        Reviewed by Tim Horton.
     7       
     8        Clean up the code path called after the ScrollingTree has scrolled a node,
     9        to prepare for multiple scrolling nodes.
     10       
     11        Change "updateMainFrameScrollPosition" terminology to "updateScrollPositionAfterAsyncScroll",
     12        and pass along the ScrollingNodeID that scrolled.
     13
     14        * UIProcess/Scrolling/RemoteScrollingTree.cpp:
     15        (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
     16        * UIProcess/Scrolling/RemoteScrollingTree.h:
     17        * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
     18        (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode):
     19
    1202014-01-24  Simon Fraser  <simon.fraser@apple.com>
    221
  • trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp

    r162731 r162736  
    7777#endif
    7878
    79 void RemoteScrollingTree::updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition)
     79void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition)
    8080{
    81     // FIXME: fix for all scrolling nodes.
    82     m_scrollingCoordinatorProxy.scrollPositionChanged(rootNode()->scrollingNodeID(), scrollPosition);
     81    m_scrollingCoordinatorProxy.scrollPositionChanged(nodeID, scrollPosition);
    8382}
    8483
  • trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h

    r162731 r162736  
    5353    virtual void handleWheelEventPhase(WebCore::PlatformWheelEventPhase) override;
    5454#endif
    55     virtual void updateMainFrameScrollPosition(const WebCore::IntPoint& scrollPosition, WebCore::SetOrSyncScrollingLayerPosition = WebCore::SyncScrollingLayerPosition) override;
     55    virtual void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::IntPoint& scrollPosition, WebCore::SetOrSyncScrollingLayerPosition = WebCore::SyncScrollingLayerPosition) override;
    5656
    5757    virtual PassOwnPtr<WebCore::ScrollingTreeNode> createNode(WebCore::ScrollingNodeType, WebCore::ScrollingNodeID);
  • trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm

    r161529 r162736  
    9494void RemoteScrollingCoordinator::scrollPositionChangedForNode(ScrollingNodeID nodeID, const FloatPoint& scrollPosition)
    9595{
    96     scheduleUpdateScrollPositionForNode(nodeID, roundedIntPoint(scrollPosition), false /* FIXME */, SyncScrollingLayerPosition);
     96    scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, roundedIntPoint(scrollPosition), false /* FIXME */, SyncScrollingLayerPosition);
    9797}
    9898
Note: See TracChangeset for help on using the changeset viewer.