Changeset 106720 in webkit
- Timestamp:
- Feb 3, 2012 5:33:46 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106715 r106720 1 2012-02-03 Anders Carlsson <andersca@apple.com> 2 3 The scrolling tree should be able to handle wheel events 4 https://bugs.webkit.org/show_bug.cgi?id=77794 5 6 Reviewed by Andreas Kling. 7 8 * page/scrolling/ScrollingTree.cpp: 9 (WebCore::ScrollingTree::tryToHandleWheelEvent): 10 New function. Currently this always returns that it was able to handle the wheel event, 11 but this will change in the future. 12 13 (WebCore::ScrollingTree::handleWheelEvent): 14 Ask the root node to handle the wheel event. 15 16 * page/scrolling/ScrollingTreeNode.h: 17 Add a handleWheelEvent pure virtual member function. 18 19 * page/scrolling/mac/ScrollingTreeNodeMac.mm: 20 (WebCore::ScrollingTreeNodeMac::handleWheelEvent): 21 Call scrollBy for now. Eventually this should use a scroll elasticity controller to handle 22 things like rubber-banding. 23 24 (WebCore::ScrollingTreeNodeMac::scrollPosition): 25 (WebCore::ScrollingTreeNodeMac::setScrollPosition): 26 Add getters and setters for the scroll position. 27 28 (WebCore::ScrollingTreeNodeMac::scrollBy): 29 Update the scroll position given the offset. 30 1 31 2012-02-03 Ryosuke Niwa <rniwa@webkit.org> 2 32 -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r106696 r106720 29 29 #if ENABLE(THREADED_SCROLLING) 30 30 31 #include "PlatformWheelEvent.h" 31 32 #include "ScrollingCoordinator.h" 32 33 #include "ScrollingThread.h" … … 52 53 } 53 54 55 bool ScrollingTree::tryToHandleWheelEvent(const PlatformWheelEvent& wheelEvent) 56 { 57 // FIXME: Check for wheel event handlers. 58 // FIXME: Check if we're over a subframe or overflow div. 59 60 ScrollingThread::dispatch(bind(&ScrollingTree::handleWheelEvent, this, wheelEvent)); 61 return true; 62 } 63 64 void ScrollingTree::handleWheelEvent(const PlatformWheelEvent& wheelEvent) 65 { 66 ASSERT(ScrollingThread::isCurrentThread()); 67 68 m_rootNode->handleWheelEvent(wheelEvent); 69 } 70 54 71 void ScrollingTree::invalidate() 55 72 { -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r106696 r106720 37 37 namespace WebCore { 38 38 39 class PlatformWheelEvent; 39 40 class ScrollingCoordinator; 40 41 class ScrollingTreeNode; … … 49 50 static PassRefPtr<ScrollingTree> create(ScrollingCoordinator*); 50 51 ~ScrollingTree(); 52 53 // Can be called from any thread. Will try to handle the wheel event on the scrolling thread. 54 // Returns true if the wheel event can be handled on the scrolling thread and false if the 55 // event must be sent again to the WebCore event handler. 56 bool tryToHandleWheelEvent(const PlatformWheelEvent&); 57 58 // Must be called from the scrolling thread. Handles the wheel event. 59 void handleWheelEvent(const PlatformWheelEvent&); 51 60 52 61 void invalidate(); -
trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h
r106711 r106720 34 34 namespace WebCore { 35 35 36 class PlatformWheelEvent; 36 37 class ScrollingTree; 37 38 class ScrollingTreeState; … … 43 44 44 45 virtual void update(ScrollingTreeState*); 46 virtual void handleWheelEvent(const PlatformWheelEvent&) = 0; 45 47 46 48 protected: -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h
r106711 r106720 42 42 private: 43 43 virtual void update(ScrollingTreeState*) OVERRIDE; 44 virtual void handleWheelEvent(const PlatformWheelEvent&) OVERRIDE; 45 46 IntPoint scrollPosition() const; 47 void setScrollPosition(const IntPoint&); 48 49 void scrollBy(const IntSize&); 44 50 45 51 RetainPtr<CALayer> m_scrollLayer; -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm
r106711 r106720 29 29 #if ENABLE(THREADED_SCROLLING) 30 30 31 #include "PlatformWheelEvent.h" 31 32 #include "ScrollingTreeState.h" 32 33 … … 51 52 } 52 53 54 void ScrollingTreeNodeMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent) 55 { 56 // FXIME: This needs to handle rubberbanding. 57 scrollBy(IntSize(-wheelEvent.deltaX(), -wheelEvent.deltaY())); 58 } 59 60 IntPoint ScrollingTreeNodeMac::scrollPosition() const 61 { 62 CGPoint scrollLayerPosition = m_scrollLayer.get().position; 63 return IntPoint(-scrollLayerPosition.x, -scrollLayerPosition.y); 64 } 65 66 void ScrollingTreeNodeMac::setScrollPosition(const IntPoint& position) 67 { 68 m_scrollLayer.get().position = CGPointMake(-position.x(), -position.y()); 69 } 70 71 void ScrollingTreeNodeMac::scrollBy(const IntSize &offset) 72 { 73 setScrollPosition(scrollPosition() + offset); 74 75 // FIXME: Tell the scrolling coordinator that our position changed. 76 } 77 53 78 } // namespace WebCore 54 79
Note: See TracChangeset
for help on using the changeset viewer.