[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

pkasting at chromium.org pkasting at chromium.org
Thu Feb 4 21:25:16 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit f8f5aae1f6310898c8b4a22735e133e40e3bfc85
Author: pkasting at chromium.org <pkasting at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 22 22:17:17 2010 +0000

    When scrolling by page, hold back 1/8th of the visible size instead of
    40 px.
    https://bugs.webkit.org/show_bug.cgi?id=32595
    
    Reviewed by David Hyatt.
    
    WebCore:
    
    * editing/EditorCommand.cpp:
    (WebCore::verticalScrollDistance):
    * platform/ScrollView.cpp:
    (WebCore::ScrollView::updateScrollbars):
    (WebCore::ScrollView::wheelEvent):
    * platform/Scrollbar.h:
    * platform/wx/ScrollViewWx.cpp:
    (WebCore::ScrollView::ScrollViewPrivate::OnScrollWinEvents):
    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::updateScrollInfoAfterLayout):
    
    WebKit/mac:
    
    * WebView/WebFrameView.mm:
    (-[WebFrameView _verticalPageScrollDistance]):
    (-[WebFrameView initWithFrame:]):
    (-[WebFrameView _horizontalPageScrollDistance]):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53718 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c755699..5c034dc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,24 @@
 2010-01-22  Peter Kasting  <pkasting at google.com>
 
+        Reviewed by David Hyatt.
+
+        When scrolling by page, hold back 1/8th of the visible size instead of
+        40 px.
+        https://bugs.webkit.org/show_bug.cgi?id=32595
+
+        * editing/EditorCommand.cpp:
+        (WebCore::verticalScrollDistance):
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::updateScrollbars):
+        (WebCore::ScrollView::wheelEvent):
+        * platform/Scrollbar.h:
+        * platform/wx/ScrollViewWx.cpp:
+        (WebCore::ScrollView::ScrollViewPrivate::OnScrollWinEvents):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
+
+2010-01-22  Peter Kasting  <pkasting at google.com>
+
         Not reviewed, backout.
 
         Back out r52673, which caused several regressions.
diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp
index fa7ca9b..6a9e10f 100644
--- a/WebCore/editing/EditorCommand.cpp
+++ b/WebCore/editing/EditorCommand.cpp
@@ -260,7 +260,7 @@ static int verticalScrollDistance(Frame* frame)
     if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || renderer->isTextArea()))
         return 0;
     int height = toRenderBox(renderer)->clientHeight();
-    return max((height + 1) / 2, height - cAmountToKeepWhenPaging);
+    return max(height * cFractionToStepWhenPaging, 1.f);
 }
 
 static RefPtr<Range> unionDOMRanges(Range* a, Range* b)
diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp
index 0f6920c..e4291cc 100644
--- a/WebCore/platform/ScrollView.cpp
+++ b/WebCore/platform/ScrollView.cpp
@@ -425,9 +425,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
     if (m_horizontalScrollbar) {
         int clientWidth = visibleWidth();
         m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth);
-        int pageStep = (clientWidth - cAmountToKeepWhenPaging);
-        if (pageStep < 0)
-            pageStep = clientWidth;
+        int pageStep = max(clientWidth * cFractionToStepWhenPaging, 1.f);
         IntRect oldRect(m_horizontalScrollbar->frameRect());
         IntRect hBarRect = IntRect(0,
                                    height() - m_horizontalScrollbar->height(),
@@ -449,7 +447,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
     if (m_verticalScrollbar) {
         int clientHeight = visibleHeight();
         m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight);
-        int pageStep = (clientHeight - cAmountToKeepWhenPaging);
+        int pageStep = max(clientHeight * cFractionToStepWhenPaging, 1.f);
         if (pageStep < 0)
             pageStep = clientHeight;
         IntRect oldRect(m_verticalScrollbar->frameRect());
@@ -665,7 +663,7 @@ void ScrollView::wheelEvent(PlatformWheelEvent& e)
         if (e.granularity() == ScrollByPageWheelEvent) {
             ASSERT(deltaX == 0);
             bool negative = deltaY < 0;
-            deltaY = max(0, visibleHeight() - cAmountToKeepWhenPaging);
+            deltaY = max(visibleHeight() * cFractionToStepWhenPaging, 1.f);
             if (negative)
                 deltaY = -deltaY;
         }
diff --git a/WebCore/platform/Scrollbar.h b/WebCore/platform/Scrollbar.h
index 67496f2..49907ba 100644
--- a/WebCore/platform/Scrollbar.h
+++ b/WebCore/platform/Scrollbar.h
@@ -40,9 +40,8 @@ class ScrollbarClient;
 class ScrollbarTheme;
 class PlatformMouseEvent;
 
-// These match the numbers we use over in WebKit (WebFrameView.m).
 const int cScrollbarPixelsPerLineStep = 40;
-const int cAmountToKeepWhenPaging = 40;
+const float cFractionToStepWhenPaging = 0.875f;
 
 class Scrollbar : public Widget {
 protected:
diff --git a/WebCore/platform/wx/ScrollViewWx.cpp b/WebCore/platform/wx/ScrollViewWx.cpp
index f556894..35acf68 100644
--- a/WebCore/platform/wx/ScrollViewWx.cpp
+++ b/WebCore/platform/wx/ScrollViewWx.cpp
@@ -96,15 +96,15 @@ public:
         }
         else if (scrollType == wxEVT_SCROLLWIN_PAGEUP) {
             if (horiz) 
-                pos.x -= m_scrollView->visibleWidth() - cAmountToKeepWhenPaging;
+                pos.x -= m_scrollView->visibleWidth() * cFractionToStepWhenPaging;
             else       
-                pos.y -= m_scrollView->visibleHeight() - cAmountToKeepWhenPaging;
+                pos.y -= m_scrollView->visibleHeight() * cFractionToStepWhenPaging;
         }
         else if (scrollType == wxEVT_SCROLLWIN_PAGEDOWN) {
             if (horiz) 
-                pos.x += m_scrollView->visibleWidth() - cAmountToKeepWhenPaging;
+                pos.x += m_scrollView->visibleWidth() * cFractionToStepWhenPaging;
             else       
-                pos.y += m_scrollView->visibleHeight() - cAmountToKeepWhenPaging;
+                pos.y += m_scrollView->visibleHeight() * cFractionToStepWhenPaging;
         }
         else
             return e.Skip();
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index d8a3288..7729ac8 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -1895,8 +1895,7 @@ RenderLayer::updateScrollInfoAfterLayout()
     // Set up the range (and page step/line step).
     if (m_hBar) {
         int clientWidth = box->clientWidth();
-        int pageStep = (clientWidth - cAmountToKeepWhenPaging);
-        if (pageStep < 0) pageStep = clientWidth;
+        int pageStep = max(clientWidth * cFractionToStepWhenPaging, 1.f);
         m_hBar->setSteps(cScrollbarPixelsPerLineStep, pageStep);
         m_hBar->setProportion(clientWidth, m_scrollWidth);
         // Explicitly set the horizontal scroll value.  This ensures that when a
@@ -1911,8 +1910,7 @@ RenderLayer::updateScrollInfoAfterLayout()
     }
     if (m_vBar) {
         int clientHeight = box->clientHeight();
-        int pageStep = (clientHeight - cAmountToKeepWhenPaging);
-        if (pageStep < 0) pageStep = clientHeight;
+        int pageStep = max(clientHeight * cFractionToStepWhenPaging, 1.f);
         m_vBar->setSteps(cScrollbarPixelsPerLineStep, pageStep);
         m_vBar->setProportion(clientHeight, m_scrollHeight);
     }
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 5cc5b3d..d98319a 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,16 @@
+2010-01-22  Peter Kasting  <pkasting at google.com>
+
+        Reviewed by David Hyatt.
+
+        When scrolling by page, hold back 1/8th of the visible size instead of
+        40 px.
+        https://bugs.webkit.org/show_bug.cgi?id=32595
+
+        * WebView/WebFrameView.mm:
+        (-[WebFrameView _verticalPageScrollDistance]):
+        (-[WebFrameView initWithFrame:]):
+        (-[WebFrameView _horizontalPageScrollDistance]):
+
 2010-01-20  Jian Li  <jianli at chromium.org>
 
         Reviewed by Dmitry Titov.
diff --git a/WebKit/mac/WebView/WebFrameView.mm b/WebKit/mac/WebView/WebFrameView.mm
index a5d6ccd..565e64d 100644
--- a/WebKit/mac/WebView/WebFrameView.mm
+++ b/WebKit/mac/WebView/WebFrameView.mm
@@ -200,9 +200,8 @@ enum {
 
 - (float)_verticalPageScrollDistance
 {
-    float overlap = [self _verticalKeyboardScrollDistance];
     float height = [[self _contentView] bounds].size.height;
-    return (height < overlap) ? height / 2 : height - overlap;
+    return max(height * cFractionToStepWhenPaging, 1.f);
 }
 
 static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCClass, NSArray *supportTypes)
@@ -343,7 +342,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
     [scrollView setHasVerticalScroller:NO];
     [scrollView setHasHorizontalScroller:NO];
     [scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
-    [scrollView setLineScroll:40.0f];
+    [scrollView setLineScroll:cScrollbarPixelsPerLineStep];
     [self addSubview:scrollView];
 
     // Don't call our overridden version of setNextKeyView here; we need to make the standard NSView
@@ -613,9 +612,8 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
 - (float)_horizontalPageScrollDistance
 {
-    float overlap = [self _horizontalKeyboardScrollDistance];
     float width = [[self _contentView] bounds].size.width;
-    return (width < overlap) ? width / 2 : width - overlap;
+    return max(width * cFractionToStepWhenPaging, 1.f);
 }
 
 - (BOOL)_pageVertically:(BOOL)up

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list