Changeset 54345 in webkit
- Timestamp:
- Feb 4, 2010 9:35:58 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r54344 r54345 1 2010-02-04 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 REGRESSION (r53718): When scrolling a tall window by page, the overlap between pages is too big 6 https://bugs.webkit.org/show_bug.cgi?id=34371 7 8 Allow ScrollbarTheme to cap the overlap between pages, and set a cap of 9 40 in ScrollbarThemeMac. 10 11 * WebCore.base.exp: Export Scrollbar::maxOverlapBetweenPages(). 12 * editing/EditorCommand.cpp: 13 (WebCore::verticalScrollDistance): Use Scrollbar methods instead of 14 constants, and cap the scroll distance if needed. 15 * platform/ScrollView.cpp: 16 (WebCore::ScrollView::updateScrollbars): Ditto. 17 (WebCore::ScrollView::wheelEvent): Ditto. 18 * platform/Scrollbar.cpp: 19 (WebCore::Scrollbar::maxOverlapBetweenPages): Added. Returns the 20 value from the native scrollbar theme. 21 * platform/Scrollbar.h: Replaced scroll amount constants with static methods. 22 (WebCore::Scrollbar::pixelsPerLineStep): Replaces cScrollbarPixelsPerLineStep. 23 (WebCore::Scrollbar::minFractionToStepWhenPaging): Replaces cFractionToStepWhenPaging. 24 * platform/ScrollbarTheme.h: 25 (WebCore::ScrollbarTheme::maxOverlapBetweenPages): A base implementation 26 that returns the largest int. 27 * platform/gtk/WheelEventGtk.cpp: 28 (WebCore::PlatformWheelEvent::PlatformWheelEvent): Use Scrollbar methods instead of 29 constants. 30 * platform/haiku/PlatformWheelEventHaiku.cpp: 31 (WebCore::PlatformWheelEvent::PlatformWheelEvent): Use Scrollbar methods instead of 32 constants. 33 * platform/mac/ScrollbarThemeMac.h: 34 (WebCore::ScrollbarThemeMac::maxOverlapBetweenPages): An override 35 that returns 40. 36 * platform/mac/WheelEventMac.mm: 37 (WebCore::PlatformWheelEvent::PlatformWheelEvent): Use 38 Scrollbar::pixelsPerLineStep() instead of cScrollbarPixelsPerLineStep. 39 * platform/wx/MouseWheelEventWx.cpp: 40 (WebCore::PlatformWheelEvent::PlatformWheelEvent): Use Scrollbar methods instead of 41 constants. 42 * platform/wx/ScrollViewWx.cpp: 43 (WebCore::ScrollView::ScrollViewPrivate::OnScrollWinEvents): Use Scrollbar 44 methods instead of constants, and cap the scroll distance if needed. 45 * rendering/RenderLayer.cpp: 46 (WebCore::RenderLayer::updateScrollInfoAfterLayout): Ditto. 47 1 48 2010-02-04 No'am Rosenthal <noam.rosenthal@nokia.com> 2 49 -
trunk/WebCore/WebCore.base.exp
r54205 r54345 1 1 2 .objc_class_name_DOMAbstractView 2 3 .objc_class_name_DOMAttr … … 761 762 __ZN7WebCore9PageGroup30removeUserStyleSheetsFromWorldEPNS_15DOMWrapperWorldE 762 763 __ZN7WebCore9PageGroup9pageGroupERKNS_6StringE 764 __ZN7WebCore9Scrollbar22maxOverlapBetweenPagesEv 763 765 __ZN7WebCore9TimerBase4stopEv 764 766 __ZN7WebCore9TimerBase5startEdd … … 1058 1060 _wkSignalCFReadStreamError 1059 1061 _wkSignalCFReadStreamHasBytes 1060 -
trunk/WebCore/editing/EditorCommand.cpp
r53718 r54345 261 261 return 0; 262 262 int height = toRenderBox(renderer)->clientHeight(); 263 return max( height * cFractionToStepWhenPaging, 1.f);263 return max(max<int>(height * Scrollbar::minFractionToStepWhenPaging(), height - Scrollbar::maxOverlapBetweenPages()), 1); 264 264 } 265 265 -
trunk/WebCore/platform/ScrollView.cpp
r53877 r54345 426 426 int clientWidth = visibleWidth(); 427 427 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); 428 int pageStep = max( clientWidth * cFractionToStepWhenPaging, 1.f);428 int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1); 429 429 IntRect oldRect(m_horizontalScrollbar->frameRect()); 430 430 IntRect hBarRect = IntRect(0, … … 438 438 if (m_scrollbarsSuppressed) 439 439 m_horizontalScrollbar->setSuppressInvalidation(true); 440 m_horizontalScrollbar->setSteps( cScrollbarPixelsPerLineStep, pageStep);440 m_horizontalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); 441 441 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); 442 442 m_horizontalScrollbar->setValue(scroll.width()); … … 448 448 int clientHeight = visibleHeight(); 449 449 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); 450 int pageStep = max( clientHeight * cFractionToStepWhenPaging, 1.f);450 int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); 451 451 if (pageStep < 0) 452 452 pageStep = clientHeight; … … 462 462 if (m_scrollbarsSuppressed) 463 463 m_verticalScrollbar->setSuppressInvalidation(true); 464 m_verticalScrollbar->setSteps( cScrollbarPixelsPerLineStep, pageStep);464 m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); 465 465 m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); 466 466 m_verticalScrollbar->setValue(scroll.height()); … … 664 664 ASSERT(deltaX == 0); 665 665 bool negative = deltaY < 0; 666 deltaY = max( visibleHeight() * cFractionToStepWhenPaging, 1.f);666 deltaY = max(max<int>(visibleHeight() * Scrollbar::minFractionToStepWhenPaging(), visibleHeight() - Scrollbar::maxOverlapBetweenPages()), 1); 667 667 if (negative) 668 668 deltaY = -deltaY; -
trunk/WebCore/platform/Scrollbar.cpp
r53651 r54345 39 39 #include <algorithm> 40 40 41 using std::max; 42 using std::min; 41 using namespace std; 43 42 44 43 namespace WebCore { … … 50 49 } 51 50 #endif 51 52 int Scrollbar::maxOverlapBetweenPages() 53 { 54 static int maxOverlapBetweenPages = ScrollbarTheme::nativeTheme()->maxOverlapBetweenPages(); 55 return maxOverlapBetweenPages; 56 } 52 57 53 58 Scrollbar::Scrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, -
trunk/WebCore/platform/Scrollbar.h
r53718 r54345 41 41 class PlatformMouseEvent; 42 42 43 const int cScrollbarPixelsPerLineStep = 40;44 const float cFractionToStepWhenPaging = 0.875f;45 46 43 class Scrollbar : public Widget { 47 protected:48 Scrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0);49 50 44 public: 51 45 virtual ~Scrollbar(); … … 53 47 // Must be implemented by platforms that can't simply use the Scrollbar base class. Right now the only platform that is not using the base class is GTK. 54 48 static PassRefPtr<Scrollbar> createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size); 55 49 50 static int pixelsPerLineStep() { return 40; } 51 static float minFractionToStepWhenPaging() { return 0.875f; } 52 static int maxOverlapBetweenPages(); 53 56 54 void setClient(ScrollbarClient* client) { m_client = client; } 57 55 ScrollbarClient* client() const { return m_client; } … … 131 129 132 130 protected: 131 Scrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0); 132 133 133 virtual void updateThumbPosition(); 134 134 virtual void updateThumbProportion(); -
trunk/WebCore/platform/ScrollbarTheme.h
r51466 r54345 82 82 virtual int trackPosition(Scrollbar*) { return 0; } // The position of the track relative to the scrollbar. 83 83 virtual int trackLength(Scrollbar*) { return 0; } // The length of the track along the axis of the scrollbar. 84 84 85 virtual int maxOverlapBetweenPages() { return std::numeric_limits<int>::max(); } 86 85 87 virtual double initialAutoscrollTimerDelay() { return 0.25; } 86 88 virtual double autoscrollTimerDelay() { return 0.05; } -
trunk/WebCore/platform/gtk/WheelEventGtk.cpp
r42199 r54345 70 70 71 71 // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event 72 m_deltaX *= static_cast<float>( cScrollbarPixelsPerLineStep);73 m_deltaY *= static_cast<float>( cScrollbarPixelsPerLineStep);72 m_deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep()); 73 m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep()); 74 74 } 75 75 -
trunk/WebCore/platform/haiku/PlatformWheelEventHaiku.cpp
r46934 r54345 55 55 m_wheelTicksY = m_deltaY; 56 56 57 m_deltaX *= - cScrollbarPixelsPerLineStep;58 m_deltaY *= - cScrollbarPixelsPerLineStep;57 m_deltaX *= -Scrollbar::pixelsPerLineStep(); 58 m_deltaY *= -Scrollbar::pixelsPerLineStep(); 59 59 } 60 60 -
trunk/WebCore/platform/mac/ScrollbarThemeMac.h
r37118 r54345 58 58 virtual IntRect trackRect(Scrollbar*, bool painting = false); 59 59 60 virtual int maxOverlapBetweenPages() { return 40; } 61 60 62 virtual int minimumThumbLength(Scrollbar*); 61 63 -
trunk/WebCore/platform/mac/WheelEventMac.mm
r44379 r54345 46 46 wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous); 47 47 if (continuous) { 48 m_wheelTicksX = m_deltaX / static_cast<float>( cScrollbarPixelsPerLineStep);49 m_wheelTicksY = m_deltaY / static_cast<float>( cScrollbarPixelsPerLineStep);48 m_wheelTicksX = m_deltaX / static_cast<float>(Scrollbar::pixelsPerLineStep()); 49 m_wheelTicksY = m_deltaY / static_cast<float>(Scrollbar::pixelsPerLineStep()); 50 50 } else { 51 51 m_wheelTicksX = m_deltaX; 52 52 m_wheelTicksY = m_deltaY; 53 m_deltaX *= static_cast<float>( cScrollbarPixelsPerLineStep);54 m_deltaY *= static_cast<float>( cScrollbarPixelsPerLineStep);53 m_deltaX *= static_cast<float>(Scrollbar::pixelsPerLineStep()); 54 m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep()); 55 55 } 56 56 } -
trunk/WebCore/platform/wx/MouseWheelEventWx.cpp
r41779 r54345 48 48 { 49 49 // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event 50 m_deltaY *= static_cast<float>( cScrollbarPixelsPerLineStep);50 m_deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep()); 51 51 } 52 52 -
trunk/WebCore/platform/wx/ScrollViewWx.cpp
r53718 r54345 85 85 else if (scrollType == wxEVT_SCROLLWIN_LINEDOWN) { 86 86 if (horiz) 87 pos.x += cScrollbarPixelsPerLineStep;88 else 89 pos.y += cScrollbarPixelsPerLineStep;87 pos.x += Scrollbar::pixelsPerLineStep(); 88 else 89 pos.y += Scrollbar::pixelsPerLineStep(); 90 90 } 91 91 else if (scrollType == wxEVT_SCROLLWIN_LINEUP) { 92 92 if (horiz) 93 pos.x -= cScrollbarPixelsPerLineStep;94 else 95 pos.y -= cScrollbarPixelsPerLineStep;93 pos.x -= Scrollbar::pixelsPerLineStep(); 94 else 95 pos.y -= Scrollbar::pixelsPerLineStep(); 96 96 } 97 97 else if (scrollType == wxEVT_SCROLLWIN_PAGEUP) { 98 98 if (horiz) 99 pos.x -= m _scrollView->visibleWidth() * cFractionToStepWhenPaging;100 else 101 pos.y -= m _scrollView->visibleHeight() * cFractionToStepWhenPaging;99 pos.x -= max<int>(m_scrollView->visibleWidth() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleWidth() - Scrollbar::maxOverlapBetweenPages()); 100 else 101 pos.y -= max<int>(m_scrollView->visibleHeight() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleHeight() - Scrollbar::maxOverlapBetweenPages()); 102 102 } 103 103 else if (scrollType == wxEVT_SCROLLWIN_PAGEDOWN) { 104 104 if (horiz) 105 pos.x += m _scrollView->visibleWidth() * cFractionToStepWhenPaging;106 else 107 pos.y += m _scrollView->visibleHeight() * cFractionToStepWhenPaging;105 pos.x += max<int>(m_scrollView->visibleWidth() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleWidth() - Scrollbar::maxOverlapBetweenPages()); 106 else 107 pos.y += max<int>(m_scrollView->visibleHeight() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleHeight() - Scrollbar::maxOverlapBetweenPages()); 108 108 } 109 109 else -
trunk/WebCore/rendering/RenderLayer.cpp
r54006 r54345 1935 1935 if (m_hBar) { 1936 1936 int clientWidth = box->clientWidth(); 1937 int pageStep = max( clientWidth * cFractionToStepWhenPaging, 1.f);1938 m_hBar->setSteps( cScrollbarPixelsPerLineStep, pageStep);1937 int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1); 1938 m_hBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); 1939 1939 m_hBar->setProportion(clientWidth, m_scrollWidth); 1940 1940 // Explicitly set the horizontal scroll value. This ensures that when a … … 1950 1950 if (m_vBar) { 1951 1951 int clientHeight = box->clientHeight(); 1952 int pageStep = max( clientHeight * cFractionToStepWhenPaging, 1.f);1953 m_vBar->setSteps( cScrollbarPixelsPerLineStep, pageStep);1952 int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); 1953 m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); 1954 1954 m_vBar->setProportion(clientHeight, m_scrollHeight); 1955 1955 } -
trunk/WebKit/mac/ChangeLog
r54268 r54345 1 2010-02-04 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 REGRESSION (r53718): When scrolling a tall window by page, the overlap between pages is too big 6 https://bugs.webkit.org/show_bug.cgi?id=34371 7 8 * WebView/WebFrameView.mm: 9 (-[WebFrameView _verticalPageScrollDistance]): Use Scrollbar methods instead of 10 constants, and cap the scroll distance. 11 (-[WebFrameView initWithFrame:]): Use Scrollbar::pixelsPerLineStep() instead of 12 cScrollbarPixelsPerLineStep. 13 (-[WebFrameView _horizontalPageScrollDistance]):Use Scrollbar methods instead of 14 constants, and cap the scroll distance. 15 1 16 2010-02-01 Shinichiro Hamaji <hamaji@chromium.org> 2 17 -
trunk/WebKit/mac/WebView/WebFrameView.mm
r53718 r54345 202 202 { 203 203 float height = [[self _contentView] bounds].size.height; 204 return max (height * cFractionToStepWhenPaging, 1.f);204 return max<float>(height * Scrollbar::minFractionToStepWhenPaging(), height - Scrollbar::maxOverlapBetweenPages()); 205 205 } 206 206 … … 343 343 [scrollView setHasHorizontalScroller:NO]; 344 344 [scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; 345 [scrollView setLineScroll: cScrollbarPixelsPerLineStep];345 [scrollView setLineScroll:Scrollbar::pixelsPerLineStep()]; 346 346 [self addSubview:scrollView]; 347 347 … … 614 614 { 615 615 float width = [[self _contentView] bounds].size.width; 616 return max (width * cFractionToStepWhenPaging, 1.f);616 return max<float>(width * Scrollbar::minFractionToStepWhenPaging(), width - Scrollbar::maxOverlapBetweenPages()); 617 617 } 618 618 -
trunk/WebKit/wx/ChangeLog
r54309 r54345 1 2010-02-04 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 REGRESSION (r53718): When scrolling a tall window by page, the overlap between pages is too big 6 https://bugs.webkit.org/show_bug.cgi?id=34371 7 8 * WebView.cpp: 9 (wxWebView::OnKeyEvents): Use Scrollbar method instead of constant. 10 1 11 2010-02-03 Kevin Watters <kevinwatters@gmail.com> 2 12 -
trunk/WebKit/wx/WebView.cpp
r54105 r54345 798 798 case WXK_LEFT: 799 799 case WXK_NUMPAD_LEFT: 800 frame->view()->scrollBy(WebCore::IntSize(-WebCore:: cScrollbarPixelsPerLineStep, 0));800 frame->view()->scrollBy(WebCore::IntSize(-WebCore::Scrollbar::pixelsPerLineStep(), 0)); 801 801 return; 802 802 case WXK_UP: 803 803 case WXK_NUMPAD_UP: 804 frame->view()->scrollBy(WebCore::IntSize(0, -WebCore:: cScrollbarPixelsPerLineStep));804 frame->view()->scrollBy(WebCore::IntSize(0, -WebCore::Scrollbar::pixelsPerLineStep())); 805 805 return; 806 806 case WXK_RIGHT: 807 807 case WXK_NUMPAD_RIGHT: 808 frame->view()->scrollBy(WebCore::IntSize(WebCore:: cScrollbarPixelsPerLineStep, 0));808 frame->view()->scrollBy(WebCore::IntSize(WebCore::Scrollbar::pixelsPerLineStep(), 0)); 809 809 return; 810 810 case WXK_DOWN: 811 811 case WXK_NUMPAD_DOWN: 812 frame->view()->scrollBy(WebCore::IntSize(0, WebCore:: cScrollbarPixelsPerLineStep));812 frame->view()->scrollBy(WebCore::IntSize(0, WebCore::Scrollbar::pixelsPerLineStep())); 813 813 return; 814 814 case WXK_END: … … 822 822 case WXK_PAGEUP: 823 823 case WXK_NUMPAD_PAGEUP: 824 frame->view()->scrollBy(WebCore::IntSize(0, -frame->view()->visibleHeight() * WebCore:: cFractionToStepWhenPaging));824 frame->view()->scrollBy(WebCore::IntSize(0, -frame->view()->visibleHeight() * WebCore::ScrollBar::minFractionToStepWhenPaging())); 825 825 return; 826 826 case WXK_PAGEDOWN: 827 827 case WXK_NUMPAD_PAGEDOWN: 828 frame->view()->scrollBy(WebCore::IntSize(0, frame->view()->visibleHeight() * WebCore:: cFractionToStepWhenPaging));828 frame->view()->scrollBy(WebCore::IntSize(0, frame->view()->visibleHeight() * WebCore::ScrollBar::minFractionToStepWhenPaging())); 829 829 return; 830 830 //These we don't want turning into char events, stuff 'em
Note: See TracChangeset
for help on using the changeset viewer.