Title: [95997] trunk/Source/WebCore
Revision
95997
Author
[email protected]
Date
2011-09-26 14:44:26 -0700 (Mon, 26 Sep 2011)

Log Message

Fix full-page rubber band overhang appearing when gesturing during a slow page load.
https://bugs.webkit.org/show_bug.cgi?id=68568

Chromium bug: http://code.google.com/p/chromium/issues/detail?id=97243

(This also happens on Safari.)

The problem was that ScrollView::overhangAmount() was returning a full-page overhang due to contentsSize() being 0 briefly during a page load, which was then getting used by ScrollAnimatorChromiumMac.mm to update the overhang on a gesture event. This change makes the relevant logic not return an overhang if the contentsSize() is empty.

Patch by Alexei Svitkine <[email protected]> on 2011-09-26
Reviewed by Adam Barth.

No new tests, since this is highly timing-related.

* platform/ScrollView.cpp:
(WebCore::ScrollView::overhangAmount):
(WebCore::ScrollView::wheelEvent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (95996 => 95997)


--- trunk/Source/WebCore/ChangeLog	2011-09-26 21:44:11 UTC (rev 95996)
+++ trunk/Source/WebCore/ChangeLog	2011-09-26 21:44:26 UTC (rev 95997)
@@ -1,3 +1,22 @@
+2011-09-26  Alexei Svitkine  <[email protected]>
+
+        Fix full-page rubber band overhang appearing when gesturing during a slow page load.
+        https://bugs.webkit.org/show_bug.cgi?id=68568
+
+        Chromium bug: http://code.google.com/p/chromium/issues/detail?id=97243
+
+        (This also happens on Safari.)
+
+        The problem was that ScrollView::overhangAmount() was returning a full-page overhang due to contentsSize() being 0 briefly during a page load, which was then getting used by ScrollAnimatorChromiumMac.mm to update the overhang on a gesture event. This change makes the relevant logic not return an overhang if the contentsSize() is empty.
+
+        Reviewed by Adam Barth.
+
+        No new tests, since this is highly timing-related.
+
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::overhangAmount):
+        (WebCore::ScrollView::wheelEvent):
+
 2011-09-26  W. James MacLean  <[email protected]>
 
         [chromium] Revise zoom animator backend to use full transform instead of just scale.

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (95996 => 95997)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2011-09-26 21:44:11 UTC (rev 95996)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2011-09-26 21:44:26 UTC (rev 95997)
@@ -411,14 +411,14 @@
     int physicalScrollY = scrollPosition().y() + m_scrollOrigin.y();
     if (physicalScrollY < 0)
         stretch.setHeight(physicalScrollY);
-    else if (physicalScrollY > contentsHeight() - visibleContentRect().height())
-        stretch.setHeight(physicalScrollY - (contentsHeight() - visibleContentRect().height()));
+    else if (contentsHeight() && physicalScrollY > contentsHeight() - visibleHeight())
+        stretch.setHeight(physicalScrollY - (contentsHeight() - visibleHeight()));
 
     int physicalScrollX = scrollPosition().x() + m_scrollOrigin.x();
     if (physicalScrollX < 0)
         stretch.setWidth(physicalScrollX);
-    else if (physicalScrollX > contentsWidth() - visibleContentRect().width())
-        stretch.setWidth(physicalScrollX - (contentsWidth() - visibleContentRect().width()));
+    else if (contentsWidth() && physicalScrollX > contentsWidth() - visibleWidth())
+        stretch.setWidth(physicalScrollX - (contentsWidth() - visibleWidth()));
 
     return stretch;
 }
@@ -1046,8 +1046,8 @@
     if (physicalScrollY < 0) {
         horizontalOverhangRect = frameRect();
         horizontalOverhangRect.setHeight(-physicalScrollY);
-    } else if (physicalScrollY > contentsHeight() - visibleContentRect().height()) {
-        int height = physicalScrollY - (contentsHeight() - visibleContentRect().height());
+    } else if (contentsHeight() && physicalScrollY > contentsHeight() - visibleHeight()) {
+        int height = physicalScrollY - (contentsHeight() - visibleHeight());
         horizontalOverhangRect = frameRect();
         horizontalOverhangRect.setY(frameRect().maxY() - height - horizontalScrollbarHeight);
         horizontalOverhangRect.setHeight(height);
@@ -1062,8 +1062,8 @@
             verticalOverhangRect.setY(frameRect().y() + horizontalOverhangRect.height());
         else
             verticalOverhangRect.setY(frameRect().y());
-    } else if (physicalScrollX > contentsWidth() - visibleContentRect().width()) {
-        int width = physicalScrollX - (contentsWidth() - visibleContentRect().width());
+    } else if (contentsWidth() && physicalScrollX > contentsWidth() - visibleWidth()) {
+        int width = physicalScrollX - (contentsWidth() - visibleWidth());
         verticalOverhangRect.setWidth(width);
         verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhangRect.height());
         verticalOverhangRect.setX(frameRect().maxX() - width - verticalScrollbarWidth);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to