Changeset 106752 in webkit


Ignore:
Timestamp:
Feb 4, 2012 5:03:24 PM (12 years ago)
Author:
andersca@apple.com
Message:

Remove dead code from ScrollingCoordinator
https://bugs.webkit.org/show_bug.cgi?id=77821

Reviewed by Sam Weinig.

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

(WebCore::ScrollingCoordinator::ScrollingCoordinator):

  • page/scrolling/ScrollingCoordinator.h:

(ScrollingCoordinator):

  • page/scrolling/mac/ScrollingCoordinatorMac.mm:

(WebCore::ScrollingCoordinator::frameViewScrollLayerDidChange):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::frameViewDidChangeSize):
(WebCore::RenderLayerCompositor::updateRootLayerPosition):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106750 r106752  
     12012-02-04  Anders Carlsson  <andersca@apple.com>
     2
     3        Remove dead code from ScrollingCoordinator
     4        https://bugs.webkit.org/show_bug.cgi?id=77821
     5
     6        Reviewed by Sam Weinig.
     7
     8        * WebCore.exp.in:
     9        * page/scrolling/ScrollingCoordinator.cpp:
     10        (WebCore::ScrollingCoordinator::ScrollingCoordinator):
     11        * page/scrolling/ScrollingCoordinator.h:
     12        (ScrollingCoordinator):
     13        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
     14        (WebCore::ScrollingCoordinator::frameViewScrollLayerDidChange):
     15        * rendering/RenderLayerCompositor.cpp:
     16        (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
     17        (WebCore::RenderLayerCompositor::updateRootLayerPosition):
     18
    1192012-02-04  Anders Carlsson  <andersca@apple.com>
    220
  • trunk/Source/WebCore/WebCore.exp.in

    r106723 r106752  
    20692069__ZN7WebCore13ScrollingTree21tryToHandleWheelEventERKNS_18PlatformWheelEventE
    20702070__ZN7WebCore13ScrollingTreeD1Ev
    2071 __ZN7WebCore20ScrollingCoordinator16handleWheelEventERKNS_18PlatformWheelEventE
    2072 __ZN7WebCore20ScrollingCoordinatorD1Ev
    20732071__ZN7WebCore4Page20scrollingCoordinatorEv
    20742072__ZNK7WebCore20ScrollingCoordinator13scrollingTreeEv
    2075 
    2076 #if ENABLE(GESTURE_EVENTS)
    2077 __ZN7WebCore20ScrollingCoordinator18handleGestureEventERKNS_20PlatformGestureEventE
    2078 #endif
    2079 
    20802073#endif
    20812074
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r106750 r106752  
    5555    , m_scrollingTreeState(ScrollingTreeState::create())
    5656    , m_scrollingTreeStateCommitterTimer(this, &ScrollingCoordinator::scrollingTreeStateCommitterTimerFired)
    57     , m_didDispatchDidUpdateMainFrameScrollPosition(false)
    5857{
    5958}
     
    121120}
    122121
    123 void ScrollingCoordinator::syncFrameViewGeometry(FrameView* frameView)
    124 {
    125     ASSERT(isMainThread());
    126     ASSERT(m_page);
    127 
    128     if (frameView->frame() != m_page->mainFrame())
    129         return;
    130 
    131     IntRect visibleContentRect = frameView->visibleContentRect();
    132     IntSize contentsSize = frameView->contentsSize();
    133 
    134     MutexLocker locker(m_mainFrameGeometryMutex);
    135     if (m_mainFrameVisibleContentRect == visibleContentRect && m_mainFrameContentsSize == contentsSize)
    136         return;
    137 
    138     m_mainFrameVisibleContentRect = visibleContentRect;
    139     m_mainFrameContentsSize = contentsSize;
    140 
    141     // FIXME: Inform the scrolling thread that the frame geometry has changed.
    142 }
    143 
    144 bool ScrollingCoordinator::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
    145 {
    146     // FIXME: Check for wheel event handlers.
    147     // FIXME: Check if we're over a subframe or overflow div.
    148     // FIXME: As soon as we've determined that we can handle the wheel event, we should do the
    149     // bulk of the work on the scrolling thread and return from this function.
    150     // FIXME: Handle rubberbanding.
    151     float deltaX = wheelEvent.deltaX();
    152     float deltaY = wheelEvent.deltaY();
    153 
    154     // Slightly prefer scrolling vertically by applying the = case to deltaY
    155     if (fabsf(deltaY) >= fabsf(deltaX))
    156         deltaX = 0;
    157     else
    158         deltaY = 0;
    159 
    160     IntSize scrollOffset = IntSize(-deltaX, -deltaY);
    161     ScrollingThread::dispatch(bind(&ScrollingCoordinator::scrollByOnScrollingThread, this, scrollOffset));
    162     return true;
    163 }
    164 
    165 #if ENABLE(GESTURE_EVENTS)
    166 bool ScrollingCoordinator::handleGestureEvent(const PlatformGestureEvent&)
    167 {
    168     // FIXME: Implement.
    169     return false;
    170 }
    171 #endif
    172 
    173 void ScrollingCoordinator::didUpdateMainFrameScrollPosition()
    174 {
    175     ASSERT(isMainThread());
    176 
    177     if (!m_page)
    178         return;
    179 
    180     IntPoint scrollPosition;
    181 
    182     {
    183         MutexLocker locker(m_mainFrameGeometryMutex);
    184         ASSERT(m_didDispatchDidUpdateMainFrameScrollPosition);
    185 
    186         scrollPosition = m_mainFrameScrollPosition;
    187         m_didDispatchDidUpdateMainFrameScrollPosition = false;
    188     }
    189 
    190     if (FrameView* frameView = m_page->mainFrame()->view()) {
    191         frameView->setConstrainsScrollingToContentEdge(false);
    192         frameView->scrollToOffsetWithoutAnimation(scrollPosition);
    193         frameView->setConstrainsScrollingToContentEdge(true);
    194     }
    195 }
    196 
    197122void ScrollingCoordinator::scheduleTreeStateCommit()
    198123{
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r106750 r106752  
    8080    void updateMainFrameScrollPosition(const IntPoint&);
    8181
    82     // Should be called whenever the geometry of the given frame view changes,
    83     // including the visible content rect and the content size.
    84     void syncFrameViewGeometry(FrameView*);
    85 
    86     // Can be called from any thread. Will try to handle the wheel event on the scrolling thread,
    87     // and return false if the event must be sent again to the WebCore event handler.
    88     bool handleWheelEvent(const PlatformWheelEvent&);
    89 
    90 #if ENABLE(GESTURE_EVENTS)
    91     // Can be called from any thread. Will try to handle the gesture event on the scrolling thread,
    92     // and return false if the event must be sent again to the WebCore event handler.
    93     bool handleGestureEvent(const PlatformGestureEvent&);
    94 #endif
    95 
    9682private:
    9783    explicit ScrollingCoordinator(Page*);
    9884
    99     // The following functions can only be called from the main thread.
    100     void didUpdateMainFrameScrollPosition();
    101 
    102     // The following functions can only be called from the scrolling thread.
    103     void scrollByOnScrollingThread(const IntSize& offset);
    104 
    105     // This function must be called with the main frame geometry mutex held.
    106     void updateMainFrameScrollLayerPositionOnScrollingThread(const FloatPoint&);
    107 
    108 private:
    10985    void scheduleTreeStateCommit();
    11086    void scrollingTreeStateCommitterTimerFired(Timer<ScrollingCoordinator>*);
     
    11793    OwnPtr<ScrollingTreeState> m_scrollingTreeState;
    11894    Timer<ScrollingCoordinator> m_scrollingTreeStateCommitterTimer;
    119 
    120     Mutex m_mainFrameGeometryMutex;
    121     IntRect m_mainFrameVisibleContentRect;
    122     IntSize m_mainFrameContentsSize;
    123 #if PLATFORM(MAC)
    124     RetainPtr<PlatformLayer> m_mainFrameScrollLayer;
    125 #endif
    126 
    127     bool m_didDispatchDidUpdateMainFrameScrollPosition;
    128     IntPoint m_mainFrameScrollPosition;
    12995};
    13096
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm

    r106696 r106752  
    7575    m_scrollingTreeState->setScrollLayer(scrollLayer);
    7676    scheduleTreeStateCommit();
    77 
    78     MutexLocker locker(m_mainFrameGeometryMutex);
    79     m_mainFrameScrollLayer = scrollLayer->platformLayer();
    80 
    81     // FIXME: Inform the scrolling thread?
    82 }
    83 
    84 #define ENABLE_FREE_SCROLLING 0
    85 
    86 void ScrollingCoordinator::scrollByOnScrollingThread(const IntSize& offset)
    87 {
    88     ASSERT(ScrollingThread::isCurrentThread());
    89 
    90     MutexLocker locker(m_mainFrameGeometryMutex);
    91 
    92     // FIXME: Should we cache the scroll position as well or always get it from the layer?
    93     IntPoint scrollPosition = IntPoint([m_mainFrameScrollLayer.get() position]);
    94     scrollPosition = -scrollPosition;
    95 
    96     scrollPosition += offset;
    97 
    98 #if !ENABLE_FREE_SCROLLING
    99     scrollPosition.clampNegativeToZero();
    100 
    101     IntPoint maximumScrollPosition = IntPoint(m_mainFrameContentsSize.width() - m_mainFrameVisibleContentRect.width(), m_mainFrameContentsSize.height() - m_mainFrameVisibleContentRect.height());
    102     scrollPosition = scrollPosition.shrunkTo(maximumScrollPosition);
    103 #endif
    104 
    105     updateMainFrameScrollLayerPositionOnScrollingThread(-scrollPosition);
    106 
    107     m_mainFrameScrollPosition = scrollPosition;
    108     if (!m_didDispatchDidUpdateMainFrameScrollPosition) {
    109         callOnMainThread(bind(&ScrollingCoordinator::didUpdateMainFrameScrollPosition, this));
    110         m_didDispatchDidUpdateMainFrameScrollPosition = true;
    111     }
    112 }
    113 
    114 void ScrollingCoordinator::updateMainFrameScrollLayerPositionOnScrollingThread(const FloatPoint& scrollLayerPosition)
    115 {
    116     ASSERT(ScrollingThread::isCurrentThread());
    117     ASSERT(!m_mainFrameGeometryMutex.tryLock());
    118 
    119     [CATransaction begin];
    120     [CATransaction setDisableActions:YES];
    121     [m_mainFrameScrollLayer.get() setPosition:scrollLayerPosition];
    122     [CATransaction commit];
    12377}
    12478
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r106588 r106752  
    973973            m_layerForOverhangAreas->setSize(frameView->frameRect().size());
    974974#endif
    975 
    976 #if ENABLE(THREADED_SCROLLING)
    977         if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    978             scrollingCoordinator->syncFrameViewGeometry(frameView);
    979 #endif
    980975    }
    981976}
     
    12371232        m_clipLayer->setSize(frameView->visibleContentRect(false /* exclude scrollbars */).size());
    12381233    }
    1239 
    1240 #if ENABLE(THREADED_SCROLLING)
    1241     if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
    1242         scrollingCoordinator->syncFrameViewGeometry(m_renderView->frameView());
    1243 #endif
    12441234}
    12451235
Note: See TracChangeset for help on using the changeset viewer.