make tap initiated scrolls more reliable

Programmatic scrolls fail when the scroll has not had a chance
to start. In this case, the current position equals the last
position; the logic erroneously cancels the scrolls, assuming
that in this case the scroll has finished.

Also, new scrolls should cancel the old velocity whether they
are animated or not.

This has a companion change in external/webkit, which is not
required, but makes tap initiated scrolls work more reliably.

bug:1331125
bug:3099569
Change-Id: I80ae8e8cdefce2d8d09532f79d1b2e1ae4738fa6
This commit is contained in:
Cary Clark
2010-11-16 09:59:40 -05:00
parent debf3bed9e
commit 21a97ef9f2

View File

@@ -2384,7 +2384,6 @@ public class WebView extends AbsoluteLayout
Rect sendOurVisibleRect() {
if (mZoomManager.isPreventingWebkitUpdates()) return mLastVisibleRectSent;
Rect rect = new Rect();
calcOurContentVisibleRect(rect);
// Rect.equals() checks for null input.
@@ -2937,7 +2936,8 @@ public class WebView extends AbsoluteLayout
postInvalidate(); // So we draw again
if (oldX != mScrollX || oldY != mScrollY) {
onScrollChanged(mScrollX, mScrollY, oldX, oldY);
} else {
} else if (mScroller.getStartX() != mScrollX
|| mScroller.getStartY() != mScrollY) {
abortAnimation();
mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY);
WebViewCore.resumePriority();
@@ -2970,6 +2970,7 @@ public class WebView extends AbsoluteLayout
if ((dx | dy) == 0) {
return false;
}
abortAnimation();
if (animate) {
// Log.d(LOGTAG, "startScroll: " + dx + " " + dy);
mScroller.startScroll(mScrollX, mScrollY, dx, dy,
@@ -2977,7 +2978,6 @@ public class WebView extends AbsoluteLayout
awakenScrollBars(mScroller.getDuration());
invalidate();
} else {
abortAnimation(); // just in case
scrollTo(x, y);
}
return true;