summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Leon Scroggins <scroggo@google.com> 2009-09-17 17:27:13 -0400
committer Leon Scroggins <scroggo@google.com> 2009-09-18 12:44:03 -0400
commit83d4ba83ddf8309d2c0c38d69154217d6a9c0a6c (patch)
tree1ae038968d2d3352a11346358fb4977386e7faa7
parent6ed525ecee76541aa60ca95598330e990fa16ffa (diff)
Do not attempt to retry a scrollTo with a negative position.
Fixes http://b/issue?id=2093435 Change-Id: If938c8f6e5d74b91e39a06a5736967663c9800b7
-rw-r--r--core/java/android/webkit/WebView.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index e23ed41a50b8..7e8ba8f60b42 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;