From: commit-queue@webkit.org Date: Mon, 26 Sep 2011 21:44:26 +0000 (+0000) Subject: Fix full-page rubber band overhang appearing when gesturing during a slow page load. X-Git-Tag: 070512121124~23656 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9dcd174dc57259b8562715c91533f727e899937;p=profile%2Fivi%2Fwebkit-efl.git 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 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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95997 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 442dab9..0d3d37e 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,22 @@ +2011-09-26 Alexei Svitkine + + 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 [chromium] Revise zoom animator backend to use full transform instead of just scale. diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp index 514b52a..fd07a8e 100644 --- a/Source/WebCore/platform/ScrollView.cpp +++ b/Source/WebCore/platform/ScrollView.cpp @@ -411,14 +411,14 @@ IntSize ScrollView::overhangAmount() const 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 @@ void ScrollView::calculateOverhangAreasForPainting(IntRect& horizontalOverhangRe 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 @@ void ScrollView::calculateOverhangAreasForPainting(IntRect& horizontalOverhangRe 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);