From 327dce9e36f86dcb57bc45da6273df27aab60b02 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Fri, 2 Apr 2010 15:38:55 -0700 Subject: [PATCH] Make sure when WebView modified mScrollX/Y directly, onScrollChanged() is called so that the View system can do what it needs to adjust. As WebView's onScrollChanged will call sendOurVisibleRect(), we don't need to call it explicitly any more. Fix http://b/issue?id=2438457 --- core/java/android/webkit/WebView.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 74229b8449218..0eb51775611de 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2066,7 +2066,7 @@ public class WebView extends AbsoluteLayout mScrollX = pinLocX(mScrollX); mScrollY = pinLocY(mScrollY); if (oldX != mScrollX || oldY != mScrollY) { - sendOurVisibleRect(); + onScrollChanged(mScrollX, mScrollY, oldX, oldY); } if (!mScroller.isFinished()) { // We are in the middle of a scroll. Repin the final scroll @@ -2130,9 +2130,12 @@ public class WebView extends AbsoluteLayout mScrollX = pinLocX(Math.round(sx)); mScrollY = pinLocY(Math.round(sy)); + if (oldX != mScrollX || oldY != mScrollY) { + onScrollChanged(mScrollX, mScrollY, oldX, oldY); + } + // update webkit sendViewSizeZoom(); - sendOurVisibleRect(); } } } @@ -2634,9 +2637,7 @@ public class WebView extends AbsoluteLayout mScrollY = mScroller.getCurrY(); postInvalidate(); // So we draw again if (oldX != mScrollX || oldY != mScrollY) { - // As onScrollChanged() is not called, sendOurVisibleRect() - // needs to be called explicitly. - sendOurVisibleRect(); + onScrollChanged(mScrollX, mScrollY, oldX, oldY); } } else { super.computeScroll(); @@ -3347,8 +3348,10 @@ public class WebView extends AbsoluteLayout mUserScroll = false; mWebViewCore.sendMessage(EventHub.SYNC_SCROLL, oldScrollX, oldScrollY); + onScrollChanged(mScrollX, mScrollY, oldScrollX, oldScrollY); + } else { + sendOurVisibleRect(); } - sendOurVisibleRect(); } }