Changeset 96561 in webkit
- Timestamp:
- Oct 3, 2011 5:29:13 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r96558 r96561 1 2011-10-03 Anders Carlsson <andersca@apple.com> 2 3 Work towards making PlatformWheelEvent immutable 4 https://bugs.webkit.org/show_bug.cgi?id=69306 5 6 Reviewed by Sam Weinig. 7 8 Currently, PlatformWheelEvent has an m_isAccepted flag that tracks whether 9 the event has been handled or not. For all other event types, that state is instead 10 tracked by the return value of the various event handlers. 11 12 As a first step, add return values to the various handleWheelEvent functions and 13 add an assertion in EventHandler::wheelEvent that the return value is the same as 14 the state of PlatformWheelEvent::isAccepted. 15 16 * Configurations/Base.xcconfig: 17 Don't warn when using C++11 extensions. 18 19 * page/mac/EventHandlerMac.mm: 20 (WebCore::EventHandler::wheelEvent): 21 Assert that isAccepted matches the return value. 22 23 * platform/ScrollAnimator.cpp: 24 (WebCore::ScrollAnimator::handleWheelEvent): 25 Return isAccepted. 26 27 * platform/ScrollAnimator.h: 28 HandleWheelEvent now returns a boolean. 29 30 * platform/ScrollView.cpp: 31 (WebCore::ScrollView::wheelEvent): 32 Return whether the event was handled or not. 33 34 * platform/ScrollView.h: 35 ScrollView::wheelEvent now returns a bool. 36 37 * platform/ScrollableArea.cpp: 38 (WebCore::ScrollableArea::handleWheelEvent): 39 * platform/ScrollableArea.h: 40 ScrollableArea::handleWheelEvent now returns a bool. 41 42 * platform/chromium/ScrollAnimatorChromiumMac.h: 43 * platform/chromium/ScrollAnimatorChromiumMac.mm: 44 (WebCore::ScrollAnimatorChromiumMac::handleWheelEvent): 45 Add return values, based on either the base class calls or the state of 46 PlatformWheelEvent::isAccepted(). 47 48 * platform/mac/ScrollAnimatorMac.h: 49 * platform/mac/ScrollAnimatorMac.mm: 50 (WebCore::ScrollAnimatorMac::handleWheelEvent): 51 Ditto. 52 1 53 2011-10-03 Dan Bernstein <mitz@apple.com> 2 54 -
trunk/Source/WebCore/Configurations/Base.xcconfig
r95049 r96561 24 24 #include "CompilerVersion.xcconfig" 25 25 26 CLANG_WARN_CXX0X_EXTENSIONS = NO; 26 27 DEBUG_INFORMATION_FORMAT = dwarf; 27 28 GCC_C_LANGUAGE_STANDARD = gnu99; -
trunk/Source/WebCore/page/mac/EventHandlerMac.mm
r95749 r96561 107 107 108 108 PlatformWheelEvent wheelEvent(event, page->chrome()->platformPageClient()); 109 handleWheelEvent(wheelEvent); 110 109 bool handled = handleWheelEvent(wheelEvent); 110 111 ASSERT(handled == wheelEvent.isAccepted()); 111 112 return wheelEvent.isAccepted(); 112 113 } -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r95901 r96561 82 82 } 83 83 84 voidScrollAnimator::handleWheelEvent(PlatformWheelEvent& e)84 bool ScrollAnimator::handleWheelEvent(PlatformWheelEvent& e) 85 85 { 86 86 Scrollbar* horizontalScrollbar = m_scrollableArea->horizontalScrollbar(); … … 112 112 scroll(HorizontalScrollbar, ScrollByPixel, horizontalScrollbar->pixelStep(), -deltaX); 113 113 } 114 115 return e.isAccepted(); 114 116 } 115 117 -
trunk/Source/WebCore/platform/ScrollAnimator.h
r95901 r96561 64 64 virtual void setIsActive() { } 65 65 66 virtual voidhandleWheelEvent(PlatformWheelEvent&);66 virtual bool handleWheelEvent(PlatformWheelEvent&); 67 67 #if ENABLE(GESTURE_EVENTS) 68 68 virtual void handleGestureEvent(const PlatformGestureEvent&); -
trunk/Source/WebCore/platform/ScrollView.cpp
r96547 r96561 798 798 } 799 799 800 voidScrollView::wheelEvent(PlatformWheelEvent& e)800 bool ScrollView::wheelEvent(PlatformWheelEvent& e) 801 801 { 802 802 // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled. … … 806 806 if (!canHaveScrollbars() || platformWidget()) { 807 807 #endif 808 return ;809 } 810 811 ScrollableArea::handleWheelEvent(e);808 return false; 809 } 810 811 return ScrollableArea::handleWheelEvent(e); 812 812 } 813 813 -
trunk/Source/WebCore/platform/ScrollView.h
r95725 r96561 235 235 // On Mac the underlying NSScrollView just does the scrolling, but on other platforms 236 236 // (like Windows), we need this function in order to do the scroll ourselves. 237 voidwheelEvent(PlatformWheelEvent&);237 bool wheelEvent(PlatformWheelEvent&); 238 238 #if ENABLE(GESTURE_EVENTS) 239 239 void gestureEvent(const PlatformGestureEvent&); -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r96138 r96561 124 124 } 125 125 126 voidScrollableArea::handleWheelEvent(PlatformWheelEvent& wheelEvent)127 { 128 scrollAnimator()->handleWheelEvent(wheelEvent);126 bool ScrollableArea::handleWheelEvent(PlatformWheelEvent& wheelEvent) 127 { 128 return scrollAnimator()->handleWheelEvent(wheelEvent); 129 129 } 130 130 -
trunk/Source/WebCore/platform/ScrollableArea.h
r96138 r96561 53 53 void scrollToYOffsetWithoutAnimation(float x); 54 54 55 voidhandleWheelEvent(PlatformWheelEvent&);55 bool handleWheelEvent(PlatformWheelEvent&); 56 56 #if ENABLE(GESTURE_EVENTS) 57 57 void handleGestureEvent(const PlatformGestureEvent&); -
trunk/Source/WebCore/platform/chromium/ScrollAnimatorChromiumMac.h
r95901 r96561 60 60 61 61 #if ENABLE(RUBBER_BANDING) 62 virtual void handleWheelEvent(PlatformWheelEvent&);62 virtual bool handleWheelEvent(PlatformWheelEvent&) OVERRIDE; 63 63 #if ENABLE(GESTURE_EVENTS) 64 64 virtual void handleGestureEvent(const PlatformGestureEvent&); -
trunk/Source/WebCore/platform/chromium/ScrollAnimatorChromiumMac.mm
r95901 r96561 782 782 } 783 783 784 voidScrollAnimatorChromiumMac::handleWheelEvent(PlatformWheelEvent& wheelEvent)784 bool ScrollAnimatorChromiumMac::handleWheelEvent(PlatformWheelEvent& wheelEvent) 785 785 { 786 786 m_haveScrolledSincePageLoad = true; 787 787 788 if (!wheelEvent.hasPreciseScrollingDeltas()) { 789 ScrollAnimator::handleWheelEvent(wheelEvent); 790 return; 791 } 788 if (!wheelEvent.hasPreciseScrollingDeltas()) 789 return ScrollAnimator::handleWheelEvent(wheelEvent); 792 790 793 791 // FIXME: This is somewhat roundabout hack to allow forwarding wheel events … … 796 794 // wheel event if there is nowhere to scroll. 797 795 if (fabsf(wheelEvent.deltaY()) >= fabsf(wheelEvent.deltaX())) { 798 if (!allowsVerticalStretching()) { 799 ScrollAnimator::handleWheelEvent(wheelEvent); 800 return; 801 } 796 if (!allowsVerticalStretching()) 797 return ScrollAnimator::handleWheelEvent(wheelEvent); 802 798 } else { 803 if (!allowsHorizontalStretching()) { 804 ScrollAnimator::handleWheelEvent(wheelEvent); 805 return; 806 } 799 if (!allowsHorizontalStretching()) 800 return ScrollAnimator::handleWheelEvent(wheelEvent); 807 801 808 802 if (m_scrollableArea->horizontalScrollbar()) { … … 830 824 m_scrollerInitiallyPinnedOnRight && 831 825 m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition())) { 832 ScrollAnimator::handleWheelEvent(wheelEvent); 833 return; 826 return ScrollAnimator::handleWheelEvent(wheelEvent); 834 827 } 835 828 } … … 841 834 m_ignoreMomentumScrolls = false; 842 835 wheelEvent.accept(); 836 return true; 843 837 } 844 return ;838 return false; 845 839 } 846 840 847 841 wheelEvent.accept(); 848 842 smoothScrollWithEvent(wheelEvent); 843 return true; 849 844 } 850 845 -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h
r95901 r96561 63 63 64 64 #if ENABLE(RUBBER_BANDING) 65 virtual void handleWheelEvent(PlatformWheelEvent&);65 virtual bool handleWheelEvent(PlatformWheelEvent&) OVERRIDE; 66 66 #if ENABLE(GESTURE_EVENTS) 67 67 virtual void handleGestureEvent(const PlatformGestureEvent&); -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r95901 r96561 793 793 } 794 794 795 voidScrollAnimatorMac::handleWheelEvent(PlatformWheelEvent& wheelEvent)795 bool ScrollAnimatorMac::handleWheelEvent(PlatformWheelEvent& wheelEvent) 796 796 { 797 797 m_haveScrolledSincePageLoad = true; 798 798 799 799 if (!wheelEvent.hasPreciseScrollingDeltas()) { 800 ScrollAnimator::handleWheelEvent(wheelEvent); 801 return; 800 return ScrollAnimator::handleWheelEvent(wheelEvent); 802 801 } 803 802 804 803 // FIXME: This is somewhat roundabout hack to allow forwarding wheel events 805 804 // up to the parent scrollable area. It takes advantage of the fact that 806 // the base class implemen atation of handleWheelEvent will not accept the805 // the base class implementation of handleWheelEvent will not accept the 807 806 // wheel event if there is nowhere to scroll. 808 807 if (fabsf(wheelEvent.deltaY()) >= fabsf(wheelEvent.deltaX())) { 809 if (!allowsVerticalStretching()) { 810 ScrollAnimator::handleWheelEvent(wheelEvent); 811 return; 812 } 808 if (!allowsVerticalStretching()) 809 return ScrollAnimator::handleWheelEvent(wheelEvent); 813 810 } else { 814 if (!allowsHorizontalStretching()) { 815 ScrollAnimator::handleWheelEvent(wheelEvent); 816 return; 817 } 811 if (!allowsHorizontalStretching()) 812 return ScrollAnimator::handleWheelEvent(wheelEvent); 818 813 819 814 if (m_scrollableArea->horizontalScrollbar()) { … … 841 836 m_scrollerInitiallyPinnedOnRight && 842 837 m_scrollableArea->isHorizontalScrollerPinnedToMaximumPosition())) { 843 ScrollAnimator::handleWheelEvent(wheelEvent); 844 return; 838 return ScrollAnimator::handleWheelEvent(wheelEvent); 845 839 } 846 840 } … … 852 846 m_ignoreMomentumScrolls = false; 853 847 wheelEvent.accept(); 848 return true; 854 849 } 855 return ;850 return false; 856 851 } 857 852 858 853 wheelEvent.accept(); 859 854 smoothScrollWithEvent(wheelEvent); 855 return true; 860 856 } 861 857
Note: See TracChangeset
for help on using the changeset viewer.