Changeset 83672 in webkit
- Timestamp:
- Apr 12, 2011 5:20:11 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r83671 r83672 1 2011-04-12 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Simon Fraser. 4 5 Frames prevent scrolling containing page 6 <rdar://problem/8990409> 7 https://bugs.webkit.org/show_bug.cgi?id=58392 8 9 Also fixes: 10 Should rubber-band on pages with no scrollbars 11 <rdar://problem/9034280> 12 13 * page/FrameView.cpp: 14 (WebCore::FrameView::FrameView): 15 Make the main frame rubber-band horizontally and vertically always. 16 17 * platform/ScrollTypes.h: 18 Add ScrollElasticity enum. 19 20 * platform/ScrollableArea.cpp: 21 Default to no elasticity. 22 23 (WebCore::ScrollableArea::ScrollableArea): 24 * platform/ScrollableArea.h: 25 (WebCore::ScrollableArea::setVerticalScrollElasticity): 26 (WebCore::ScrollableArea::verticalScrollElasticity): 27 (WebCore::ScrollableArea::setHorizontalScrollElasticity): 28 (WebCore::ScrollableArea::horizontalScrollElasticity): 29 Add state for horizontal and vertical elasticity. 30 31 * platform/mac/ScrollAnimatorMac.mm: 32 (WebCore::ScrollAnimatorMac::handleWheelEvent): 33 Bail out of new scrolling behavior if we can't rubber-band. By bailing before 34 accepting the wheel event, we allow the wheel event to be forwarded. We will 35 need to refine this logic to allow subframe scrolling in the future. 36 37 (WebCore::ScrollAnimatorMac::allowsVerticalStretching): 38 (WebCore::ScrollAnimatorMac::allowsHorizontalStretching): 39 Switch stretching behavior based on the ScrollableArea's elasticity. 40 1 41 2011-04-12 Geoffrey Garen <ggaren@apple.com> 2 42 -
trunk/Source/WebCore/page/FrameView.cpp
r83518 r83672 141 141 m_page = page; 142 142 m_page->addScrollableArea(this); 143 144 if (m_frame == m_page->mainFrame()) { 145 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); 146 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); 147 } 143 148 } 144 149 } -
trunk/Source/WebCore/platform/ScrollTypes.h
r82067 r83672 109 109 }; 110 110 111 enum ScrollElasticity { 112 ScrollElasticityAutomatic, 113 ScrollElasticityNone, 114 ScrollElasticityAllowed 115 }; 116 111 117 enum ScrollbarOrientation { HorizontalScrollbar, VerticalScrollbar }; 112 118 -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r79511 r83672 45 45 , m_constrainsScrollingToContentEdge(true) 46 46 , m_inLiveResize(false) 47 , m_verticalScrollElasticity(ScrollElasticityNone) 48 , m_horizontalScrollElasticity(ScrollElasticityNone) 47 49 { 48 50 } -
trunk/Source/WebCore/platform/ScrollableArea.h
r82171 r83672 57 57 bool constrainsScrollingToContentEdge() const { return m_constrainsScrollingToContentEdge; } 58 58 void setConstrainsScrollingToContentEdge(bool constrainsScrollingToContentEdge) { m_constrainsScrollingToContentEdge = constrainsScrollingToContentEdge; } 59 60 void setVerticalScrollElasticity(ScrollElasticity scrollElasticity) { m_verticalScrollElasticity = scrollElasticity; } 61 ScrollElasticity verticalScrollElasticity() const { return m_verticalScrollElasticity; } 62 63 void setHorizontalScrollElasticity(ScrollElasticity scrollElasticity) { m_horizontalScrollElasticity = scrollElasticity; } 64 ScrollElasticity horizontalScrollElasticity() const { return m_horizontalScrollElasticity; } 59 65 60 66 bool inLiveResize() const { return m_inLiveResize; } … … 131 137 bool m_inLiveResize; 132 138 139 ScrollElasticity m_verticalScrollElasticity; 140 ScrollElasticity m_horizontalScrollElasticity; 141 133 142 protected: 134 143 // There are 8 possible combinations of writing mode and direction. Scroll origin will be non-zero in the x or y axis -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r83376 r83672 790 790 } 791 791 792 // FIXME: This is somewhat roundabout hack to allow forwarding wheel events 793 // up to the parent scrollable area. It takes advantage of the fact that 794 // the base class implemenatation of handleWheelEvent will not accept the 795 // wheel event if there is nowhere to scroll. 796 if (fabsf(wheelEvent.deltaY()) >= fabsf(wheelEvent.deltaX())) { 797 if (!allowsVerticalStretching()) { 798 ScrollAnimator::handleWheelEvent(wheelEvent); 799 return; 800 } 801 } else { 802 if (!allowsHorizontalStretching()) { 803 ScrollAnimator::handleWheelEvent(wheelEvent); 804 return; 805 } 806 } 807 792 808 wheelEvent.accept(); 793 809 … … 838 854 bool ScrollAnimatorMac::allowsVerticalStretching() const 839 855 { 840 Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar(); 841 Scrollbar* vScroller = m_scrollableArea->verticalScrollbar(); 842 if (((vScroller && vScroller->enabled()) || (!hScroller || !hScroller->enabled()))) 856 switch (m_scrollableArea->verticalScrollElasticity()) { 857 case ScrollElasticityAutomatic: { 858 Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar(); 859 Scrollbar* vScroller = m_scrollableArea->verticalScrollbar(); 860 return (((vScroller && vScroller->enabled()) || (!hScroller || !hScroller->enabled()))); 861 } 862 case ScrollElasticityNone: 863 return false; 864 case ScrollElasticityAllowed: 843 865 return true; 844 866 } 867 868 ASSERT_NOT_REACHED(); 845 869 return false; 846 870 } … … 848 872 bool ScrollAnimatorMac::allowsHorizontalStretching() const 849 873 { 850 Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar(); 851 Scrollbar* vScroller = m_scrollableArea->verticalScrollbar(); 852 if (((hScroller && hScroller->enabled()) || (!vScroller || !vScroller->enabled()))) 874 switch (m_scrollableArea->horizontalScrollElasticity()) { 875 case ScrollElasticityAutomatic: { 876 Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar(); 877 Scrollbar* vScroller = m_scrollableArea->verticalScrollbar(); 878 return (((hScroller && hScroller->enabled()) || (!vScroller || !vScroller->enabled()))); 879 } 880 case ScrollElasticityNone: 881 return false; 882 case ScrollElasticityAllowed: 853 883 return true; 854 884 } 885 886 ASSERT_NOT_REACHED(); 855 887 return false; 856 888 } … … 877 909 else 878 910 deltaY = 0; 879 911 880 912 bool isVerticallyStretched = false; 881 913 bool isHorizontallyStretched = false;
Note: See TracChangeset
for help on using the changeset viewer.