Changeset 95997 in webkit


Ignore:
Timestamp:
Sep 26, 2011 2:44:26 PM (13 years ago)
Author:
commit-queue@webkit.org
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 <asvitkine@chromium.org> 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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r95988 r95997  
     12011-09-26  Alexei Svitkine  <asvitkine@chromium.org>
     2
     3        Fix full-page rubber band overhang appearing when gesturing during a slow page load.
     4        https://bugs.webkit.org/show_bug.cgi?id=68568
     5
     6        Chromium bug: http://code.google.com/p/chromium/issues/detail?id=97243
     7
     8        (This also happens on Safari.)
     9
     10        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.
     11
     12        Reviewed by Adam Barth.
     13
     14        No new tests, since this is highly timing-related.
     15
     16        * platform/ScrollView.cpp:
     17        (WebCore::ScrollView::overhangAmount):
     18        (WebCore::ScrollView::wheelEvent):
     19
    1202011-09-26  W. James MacLean  <wjmaclean@chromium.org>
    221
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r95901 r95997  
    412412    if (physicalScrollY < 0)
    413413        stretch.setHeight(physicalScrollY);
    414     else if (physicalScrollY > contentsHeight() - visibleContentRect().height())
    415         stretch.setHeight(physicalScrollY - (contentsHeight() - visibleContentRect().height()));
     414    else if (contentsHeight() && physicalScrollY > contentsHeight() - visibleHeight())
     415        stretch.setHeight(physicalScrollY - (contentsHeight() - visibleHeight()));
    416416
    417417    int physicalScrollX = scrollPosition().x() + m_scrollOrigin.x();
    418418    if (physicalScrollX < 0)
    419419        stretch.setWidth(physicalScrollX);
    420     else if (physicalScrollX > contentsWidth() - visibleContentRect().width())
    421         stretch.setWidth(physicalScrollX - (contentsWidth() - visibleContentRect().width()));
     420    else if (contentsWidth() && physicalScrollX > contentsWidth() - visibleWidth())
     421        stretch.setWidth(physicalScrollX - (contentsWidth() - visibleWidth()));
    422422
    423423    return stretch;
     
    10471047        horizontalOverhangRect = frameRect();
    10481048        horizontalOverhangRect.setHeight(-physicalScrollY);
    1049     } else if (physicalScrollY > contentsHeight() - visibleContentRect().height()) {
    1050         int height = physicalScrollY - (contentsHeight() - visibleContentRect().height());
     1049    } else if (contentsHeight() && physicalScrollY > contentsHeight() - visibleHeight()) {
     1050        int height = physicalScrollY - (contentsHeight() - visibleHeight());
    10511051        horizontalOverhangRect = frameRect();
    10521052        horizontalOverhangRect.setY(frameRect().maxY() - height - horizontalScrollbarHeight);
     
    10631063        else
    10641064            verticalOverhangRect.setY(frameRect().y());
    1065     } else if (physicalScrollX > contentsWidth() - visibleContentRect().width()) {
    1066         int width = physicalScrollX - (contentsWidth() - visibleContentRect().width());
     1065    } else if (contentsWidth() && physicalScrollX > contentsWidth() - visibleWidth()) {
     1066        int width = physicalScrollX - (contentsWidth() - visibleWidth());
    10671067        verticalOverhangRect.setWidth(width);
    10681068        verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhangRect.height());
Note: See TracChangeset for help on using the changeset viewer.