Changeset 107467 in webkit
- Timestamp:
- Feb 10, 2012 6:33:17 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r107466 r107467 1 2012-02-10 Anders Carlsson <andersca@apple.com> 2 3 Always update the scroll position through the scrolling coordinator 4 https://bugs.webkit.org/show_bug.cgi?id=78403 5 6 Reviewed by Sam Weinig. 7 8 To get correct behavior, we always want to update the scrolling layer position 9 on the scrolling thread. Do this by allowing the scrolling coordinator to intercept 10 scroll position update requests and send them to the scrolling tree. 11 12 * page/FrameView.cpp: 13 (WebCore::FrameView::requestScrollPositionUpdate): 14 Let the scrolling coordinator have a go at updating the scroll position for this frame view. 15 16 * page/scrolling/ScrollingCoordinator.cpp: 17 (WebCore::ScrollingCoordinator::requestScrollPositionUpdate): 18 If it's a frame view we're coordinating scrolling for, tell the scrolling tree to update 19 the scroll position. 20 21 * page/scrolling/ScrollingTree.cpp: 22 (WebCore::ScrollingTree::setMainFrameScrollPosition): 23 Call through to the scrolling tree node. 24 25 * page/scrolling/ScrollingTreeNode.h: 26 Add a new pure virtual setScrollPosition member function. 27 28 (WebCore::ScrollingTreeNodeMac::setScrollPosition): 29 Move most of the code from scrollBy here. 30 31 (WebCore::ScrollingTreeNodeMac::setScrollLayerPosition): 32 Rename this member function from setScrollPosition to avoid conflicts. 33 34 (WebCore::ScrollingTreeNodeMac::scrollBy): 35 Just call setScsrollPosition. 36 37 * platform/ScrollableArea.cpp: 38 (WebCore::ScrollableArea::setScrollOffsetFromAnimation): 39 Call requestScrollPositionUpdate, which allows subclasses of scrollable area to intercept 40 the scroll operation and call it asynchronously. 41 1 42 2012-02-10 Anders Carlsson <andersca@apple.com> 2 43 -
trunk/Source/WebCore/page/FrameView.cpp
r107461 r107467 1760 1760 } 1761 1761 1762 bool FrameView::requestScrollPositionUpdate(const IntPoint& position) 1763 { 1764 #if ENABLE(THREADED_SCROLLING) 1765 if (Page* page = m_frame->page()) { 1766 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) 1767 return scrollingCoordinator->requestScrollPositionUpdate(this, position); 1768 } 1769 #endif 1770 1771 return false; 1772 } 1773 1762 1774 HostWindow* FrameView::hostWindow() const 1763 1775 { -
trunk/Source/WebCore/page/FrameView.h
r107335 r107467 170 170 virtual void repaintFixedElementsAfterScrolling(); 171 171 virtual bool shouldRubberBandInDirection(ScrollDirection) const; 172 virtual bool requestScrollPositionUpdate(const IntPoint&) OVERRIDE; 172 173 173 174 virtual void zoomAnimatorTransformChanged(float, float, float, ZoomAnimationState); -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
r107466 r107467 159 159 } 160 160 161 bool ScrollingCoordinator::requestScrollPositionUpdate(FrameView* frameView, const IntPoint& scrollPosition) 162 { 163 ASSERT(isMainThread()); 164 ASSERT(m_page); 165 166 if (!coordinatesScrollingForFrameView(frameView)) 167 return false; 168 169 ScrollingThread::dispatch(bind(&ScrollingTree::setMainFrameScrollPosition, m_scrollingTree.get(), scrollPosition)); 170 return true; 171 } 172 161 173 void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition) 162 174 { -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r107335 r107467 84 84 void frameViewVerticalScrollbarLayerDidChange(FrameView*, GraphicsLayer* verticalScrollbarLayer); 85 85 86 // Requests that the scrolling coordinator updates the scroll position of the given frame view. If this function returns true, it means that the 87 // position will be updated asynchronously. If it returns false, the caller should update the scrolling position itself. 88 bool requestScrollPositionUpdate(FrameView*, const IntPoint&); 89 86 90 // Dispatched by the scrolling tree whenever the main frame scroll position changes. 87 91 void updateMainFrameScrollPosition(const IntPoint&); -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r107335 r107467 83 83 } 84 84 85 void ScrollingTree::setMainFrameScrollPosition(const IntPoint& scrollPosition) 86 { 87 ASSERT(ScrollingThread::isCurrentThread()); 88 89 m_rootNode->setScrollPosition(scrollPosition); 90 } 91 85 92 void ScrollingTree::invalidate() 86 93 { -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r107335 r107467 61 61 void handleWheelEvent(const PlatformWheelEvent&); 62 62 63 void setMainFrameScrollPosition(const IntPoint&); 64 63 65 void invalidate(); 64 66 void commitNewTreeState(PassOwnPtr<ScrollingTreeState>); -
trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h
r107335 r107467 46 46 virtual void update(ScrollingTreeState*); 47 47 virtual void handleWheelEvent(const PlatformWheelEvent&) = 0; 48 virtual void setScrollPosition(const IntPoint&) = 0; 48 49 49 50 protected: -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h
r107285 r107467 45 45 virtual void update(ScrollingTreeState*) OVERRIDE; 46 46 virtual void handleWheelEvent(const PlatformWheelEvent&) OVERRIDE; 47 virtual void setScrollPosition(const IntPoint&) OVERRIDE; 47 48 48 49 // ScrollElasticityController member functions. … … 61 62 62 63 IntPoint scrollPosition() const; 63 void setScroll Position(const IntPoint&);64 void setScrollLayerPosition(const IntPoint&); 64 65 65 66 void scrollBy(const IntSize&); -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm
r107335 r107467 57 57 // FXIME: This needs to handle rubberbanding. 58 58 scrollBy(IntSize(-wheelEvent.deltaX(), -wheelEvent.deltaY())); 59 } 60 61 void ScrollingTreeNodeMac::setScrollPosition(const IntPoint& scrollPosition) 62 { 63 if (shouldUpdateScrollLayerPositionOnMainThread()) { 64 scrollingTree()->updateMainFrameScrollPositionAndScrollLayerPosition(scrollPosition); 65 return; 66 } 67 68 setScrollLayerPosition(scrollPosition); 69 scrollingTree()->updateMainFrameScrollPosition(scrollPosition); 59 70 } 60 71 … … 133 144 } 134 145 135 void ScrollingTreeNodeMac::setScroll Position(const IntPoint& position)146 void ScrollingTreeNodeMac::setScrollLayerPosition(const IntPoint& position) 136 147 { 137 148 ASSERT(!shouldUpdateScrollLayerPositionOnMainThread()); … … 142 153 void ScrollingTreeNodeMac::scrollBy(const IntSize& offset) 143 154 { 144 IntPoint newScrollPosition = scrollPosition() + offset; 145 146 if (shouldUpdateScrollLayerPositionOnMainThread()) { 147 scrollingTree()->updateMainFrameScrollPositionAndScrollLayerPosition(newScrollPosition); 148 return; 149 } 150 151 setScrollPosition(newScrollPosition); 152 scrollingTree()->updateMainFrameScrollPosition(newScrollPosition); 155 setScrollPosition(scrollPosition() + offset); 153 156 } 154 157 -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r107466 r107467 177 177 void ScrollableArea::setScrollOffsetFromAnimation(const IntPoint& offset) 178 178 { 179 if (requestScrollPositionUpdate(offset)) 180 return; 181 179 182 notifyScrollPositionChanged(offset); 180 183 } -
trunk/Source/WebCore/platform/ScrollableArea.h
r107466 r107467 53 53 void notifyScrollPositionChanged(const IntPoint&); 54 54 55 // Allows subclasses to handle scroll position updates themselves. If this member function 56 // returns true, the scrollable area won't actually update the scroll position and instead 57 // expect it to happen sometime in the future. 58 virtual bool requestScrollPositionUpdate(const IntPoint&) { return false; } 59 55 60 virtual void zoomAnimatorTransformChanged(float, float, float, ZoomAnimationState); 56 61
Note: See TracChangeset
for help on using the changeset viewer.