Changeset 106752 in webkit
- Timestamp:
- Feb 4, 2012 5:03:24 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106750 r106752 1 2012-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 1 19 2012-02-04 Anders Carlsson <andersca@apple.com> 2 20 -
trunk/Source/WebCore/WebCore.exp.in
r106723 r106752 2069 2069 __ZN7WebCore13ScrollingTree21tryToHandleWheelEventERKNS_18PlatformWheelEventE 2070 2070 __ZN7WebCore13ScrollingTreeD1Ev 2071 __ZN7WebCore20ScrollingCoordinator16handleWheelEventERKNS_18PlatformWheelEventE2072 __ZN7WebCore20ScrollingCoordinatorD1Ev2073 2071 __ZN7WebCore4Page20scrollingCoordinatorEv 2074 2072 __ZNK7WebCore20ScrollingCoordinator13scrollingTreeEv 2075 2076 #if ENABLE(GESTURE_EVENTS)2077 __ZN7WebCore20ScrollingCoordinator18handleGestureEventERKNS_20PlatformGestureEventE2078 #endif2079 2080 2073 #endif 2081 2074 -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
r106750 r106752 55 55 , m_scrollingTreeState(ScrollingTreeState::create()) 56 56 , m_scrollingTreeStateCommitterTimer(this, &ScrollingCoordinator::scrollingTreeStateCommitterTimerFired) 57 , m_didDispatchDidUpdateMainFrameScrollPosition(false)58 57 { 59 58 } … … 121 120 } 122 121 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 the149 // 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 deltaY155 if (fabsf(deltaY) >= fabsf(deltaX))156 deltaX = 0;157 else158 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 #endif172 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 197 122 void ScrollingCoordinator::scheduleTreeStateCommit() 198 123 { -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r106750 r106752 80 80 void updateMainFrameScrollPosition(const IntPoint&); 81 81 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 #endif95 96 82 private: 97 83 explicit ScrollingCoordinator(Page*); 98 84 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:109 85 void scheduleTreeStateCommit(); 110 86 void scrollingTreeStateCommitterTimerFired(Timer<ScrollingCoordinator>*); … … 117 93 OwnPtr<ScrollingTreeState> m_scrollingTreeState; 118 94 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 #endif126 127 bool m_didDispatchDidUpdateMainFrameScrollPosition;128 IntPoint m_mainFrameScrollPosition;129 95 }; 130 96 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm
r106696 r106752 75 75 m_scrollingTreeState->setScrollLayer(scrollLayer); 76 76 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 085 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_SCROLLING99 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 #endif104 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];123 77 } 124 78 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r106588 r106752 973 973 m_layerForOverhangAreas->setSize(frameView->frameRect().size()); 974 974 #endif 975 976 #if ENABLE(THREADED_SCROLLING)977 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())978 scrollingCoordinator->syncFrameViewGeometry(frameView);979 #endif980 975 } 981 976 } … … 1237 1232 m_clipLayer->setSize(frameView->visibleContentRect(false /* exclude scrollbars */).size()); 1238 1233 } 1239 1240 #if ENABLE(THREADED_SCROLLING)1241 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())1242 scrollingCoordinator->syncFrameViewGeometry(m_renderView->frameView());1243 #endif1244 1234 } 1245 1235
Note: See TracChangeset
for help on using the changeset viewer.