Changeset 53718 in webkit
- Timestamp:
- Jan 22, 2010 2:17:17 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53716 r53718 1 2010-01-22 Peter Kasting <pkasting@google.com> 2 3 Reviewed by David Hyatt. 4 5 When scrolling by page, hold back 1/8th of the visible size instead of 6 40 px. 7 https://bugs.webkit.org/show_bug.cgi?id=32595 8 9 * editing/EditorCommand.cpp: 10 (WebCore::verticalScrollDistance): 11 * platform/ScrollView.cpp: 12 (WebCore::ScrollView::updateScrollbars): 13 (WebCore::ScrollView::wheelEvent): 14 * platform/Scrollbar.h: 15 * platform/wx/ScrollViewWx.cpp: 16 (WebCore::ScrollView::ScrollViewPrivate::OnScrollWinEvents): 17 * rendering/RenderLayer.cpp: 18 (WebCore::RenderLayer::updateScrollInfoAfterLayout): 19 1 20 2010-01-22 Peter Kasting <pkasting@google.com> 2 21 -
trunk/WebCore/editing/EditorCommand.cpp
r52314 r53718 261 261 return 0; 262 262 int height = toRenderBox(renderer)->clientHeight(); 263 return max( (height + 1) / 2, height - cAmountToKeepWhenPaging);263 return max(height * cFractionToStepWhenPaging, 1.f); 264 264 } 265 265 -
trunk/WebCore/platform/ScrollView.cpp
r53713 r53718 426 426 int clientWidth = visibleWidth(); 427 427 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); 428 int pageStep = (clientWidth - cAmountToKeepWhenPaging); 429 if (pageStep < 0) 430 pageStep = clientWidth; 428 int pageStep = max(clientWidth * cFractionToStepWhenPaging, 1.f); 431 429 IntRect oldRect(m_horizontalScrollbar->frameRect()); 432 430 IntRect hBarRect = IntRect(0, … … 450 448 int clientHeight = visibleHeight(); 451 449 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); 452 int pageStep = (clientHeight - cAmountToKeepWhenPaging);450 int pageStep = max(clientHeight * cFractionToStepWhenPaging, 1.f); 453 451 if (pageStep < 0) 454 452 pageStep = clientHeight; … … 666 664 ASSERT(deltaX == 0); 667 665 bool negative = deltaY < 0; 668 deltaY = max( 0, visibleHeight() - cAmountToKeepWhenPaging);666 deltaY = max(visibleHeight() * cFractionToStepWhenPaging, 1.f); 669 667 if (negative) 670 668 deltaY = -deltaY; -
trunk/WebCore/platform/Scrollbar.h
r45679 r53718 41 41 class PlatformMouseEvent; 42 42 43 // These match the numbers we use over in WebKit (WebFrameView.m).44 43 const int cScrollbarPixelsPerLineStep = 40; 45 const int cAmountToKeepWhenPaging = 40;44 const float cFractionToStepWhenPaging = 0.875f; 46 45 47 46 class Scrollbar : public Widget { -
trunk/WebCore/platform/wx/ScrollViewWx.cpp
r43265 r53718 97 97 else if (scrollType == wxEVT_SCROLLWIN_PAGEUP) { 98 98 if (horiz) 99 pos.x -= m_scrollView->visibleWidth() - cAmountToKeepWhenPaging;100 else 101 pos.y -= m_scrollView->visibleHeight() - cAmountToKeepWhenPaging;99 pos.x -= m_scrollView->visibleWidth() * cFractionToStepWhenPaging; 100 else 101 pos.y -= m_scrollView->visibleHeight() * cFractionToStepWhenPaging; 102 102 } 103 103 else if (scrollType == wxEVT_SCROLLWIN_PAGEDOWN) { 104 104 if (horiz) 105 pos.x += m_scrollView->visibleWidth() - cAmountToKeepWhenPaging;106 else 107 pos.y += m_scrollView->visibleHeight() - cAmountToKeepWhenPaging;105 pos.x += m_scrollView->visibleWidth() * cFractionToStepWhenPaging; 106 else 107 pos.y += m_scrollView->visibleHeight() * cFractionToStepWhenPaging; 108 108 } 109 109 else -
trunk/WebCore/rendering/RenderLayer.cpp
r53175 r53718 1896 1896 if (m_hBar) { 1897 1897 int clientWidth = box->clientWidth(); 1898 int pageStep = (clientWidth - cAmountToKeepWhenPaging); 1899 if (pageStep < 0) pageStep = clientWidth; 1898 int pageStep = max(clientWidth * cFractionToStepWhenPaging, 1.f); 1900 1899 m_hBar->setSteps(cScrollbarPixelsPerLineStep, pageStep); 1901 1900 m_hBar->setProportion(clientWidth, m_scrollWidth); … … 1912 1911 if (m_vBar) { 1913 1912 int clientHeight = box->clientHeight(); 1914 int pageStep = (clientHeight - cAmountToKeepWhenPaging); 1915 if (pageStep < 0) pageStep = clientHeight; 1913 int pageStep = max(clientHeight * cFractionToStepWhenPaging, 1.f); 1916 1914 m_vBar->setSteps(cScrollbarPixelsPerLineStep, pageStep); 1917 1915 m_vBar->setProportion(clientHeight, m_scrollHeight); -
trunk/WebKit/mac/ChangeLog
r53574 r53718 1 2010-01-22 Peter Kasting <pkasting@google.com> 2 3 Reviewed by David Hyatt. 4 5 When scrolling by page, hold back 1/8th of the visible size instead of 6 40 px. 7 https://bugs.webkit.org/show_bug.cgi?id=32595 8 9 * WebView/WebFrameView.mm: 10 (-[WebFrameView _verticalPageScrollDistance]): 11 (-[WebFrameView initWithFrame:]): 12 (-[WebFrameView _horizontalPageScrollDistance]): 13 1 14 2010-01-20 Jian Li <jianli@chromium.org> 2 15 -
trunk/WebKit/mac/WebView/WebFrameView.mm
r52314 r53718 201 201 - (float)_verticalPageScrollDistance 202 202 { 203 float overlap = [self _verticalKeyboardScrollDistance];204 203 float height = [[self _contentView] bounds].size.height; 205 return (height < overlap) ? height / 2 : height - overlap;204 return max(height * cFractionToStepWhenPaging, 1.f); 206 205 } 207 206 … … 344 343 [scrollView setHasHorizontalScroller:NO]; 345 344 [scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; 346 [scrollView setLineScroll: 40.0f];345 [scrollView setLineScroll:cScrollbarPixelsPerLineStep]; 347 346 [self addSubview:scrollView]; 348 347 … … 614 613 - (float)_horizontalPageScrollDistance 615 614 { 616 float overlap = [self _horizontalKeyboardScrollDistance];617 615 float width = [[self _contentView] bounds].size.width; 618 return (width < overlap) ? width / 2 : width - overlap;616 return max(width * cFractionToStepWhenPaging, 1.f); 619 617 } 620 618
Note: See TracChangeset
for help on using the changeset viewer.