From 83d4ba83ddf8309d2c0c38d69154217d6a9c0a6c Mon Sep 17 00:00:00 2001 From: Leon Scroggins Date: Thu, 17 Sep 2009 17:27:13 -0400 Subject: [PATCH] Do not attempt to retry a scrollTo with a negative position. Fixes http://b/issue?id=2093435 Change-Id: If938c8f6e5d74b91e39a06a5736967663c9800b7 --- core/java/android/webkit/WebView.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index e23ed41a50b81..7e8ba8f60b42a 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2484,8 +2484,11 @@ public class WebView extends AbsoluteLayout } // scale from content to view coordinates, and pin - // return true if pin caused the final x/y different than the request cx/cy; - // return false if the view scroll to the exact position as it is requested. + // return true if pin caused the final x/y different than the request cx/cy, + // and a future scroll may reach the request cx/cy after our size has + // changed + // return false if the view scroll to the exact position as it is requested, + // where negative numbers are taken to mean 0 private boolean setContentScrollTo(int cx, int cy) { if (mDrawHistory) { // disallow WebView to change the scroll position as History Picture @@ -2500,7 +2503,9 @@ public class WebView extends AbsoluteLayout // Log.d(LOGTAG, "content scrollTo [" + cx + " " + cy + "] view=[" + // vx + " " + vy + "]"); pinScrollTo(vx, vy, false, 0); - if (mScrollX != vx || mScrollY != vy) { + // If the request was to scroll to a negative coordinate, treat it as if + // it was a request to scroll to 0 + if ((mScrollX != vx && cx >= 0) || (mScrollY != vy && cy >= 0)) { return true; } else { return false;