summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Shimeng (Simon) Wang <swang@google.com> 2010-10-21 17:14:39 -0700
committer Shimeng (Simon) Wang <swang@google.com> 2010-10-22 10:29:19 -0700
commit50b1034d35e6582d7587d429b90886530c70ae8f (patch)
tree413eed0c9e4fdd20f1ff37a500abef3640b79b4f
parentf8ca2d71d50c7568e2edd16edeaa3412fa445bd2 (diff)
Pass whether a scroll is user-scrolled or not to webkit.
This is to eliminate false scrollEvent to webkit. And the side effect is that the history scroll position will be correctly restored; otherwise, webkit think there's user scrolled and not send back history scroll position. Particulary for NEW_PICTURE_MSG from webkit, the scroll event because of it are not user-scrolled. issue: 3063945 Change-Id: I9fdbfcb8baf07baf2331e2c4eed66f88aea744ef
-rw-r--r--core/java/android/webkit/WebView.java3
-rw-r--r--core/java/android/webkit/WebViewCore.java4
2 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 13b9d98dd4d3..c09519909b43 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2388,7 +2388,7 @@ public class WebView extends AbsoluteLayout
if (!rect.equals(mLastVisibleRectSent)) {
Point pos = new Point(rect.left, rect.top);
mWebViewCore.sendMessage(EventHub.SET_SCROLL_OFFSET,
- nativeMoveGeneration(), 0, pos);
+ nativeMoveGeneration(), mUserScroll ? 1 : 0, pos);
mLastVisibleRectSent = rect;
}
Rect globalRect = new Rect();
@@ -6444,6 +6444,7 @@ public class WebView extends AbsoluteLayout
}
case NEW_PICTURE_MSG_ID: {
// called for new content
+ mUserScroll = false;
final WebViewCore.DrawData draw = (WebViewCore.DrawData) msg.obj;
setBaseLayer(draw.mBaseLayer, draw.mInvalRegion.getBounds());
final Point viewSize = draw.mViewPoint;
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 8cd9f6860cb5..71da36dbc2ba 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -1074,7 +1074,7 @@ final class WebViewCore {
// note: these are in document coordinates
// (inv-zoom)
Point pt = (Point) msg.obj;
- nativeSetScrollOffset(msg.arg1, pt.x, pt.y);
+ nativeSetScrollOffset(msg.arg1, msg.arg2, pt.x, pt.y);
break;
case SET_GLOBAL_BOUNDS:
@@ -2347,7 +2347,7 @@ final class WebViewCore {
private native void nativeScrollFocusedTextInput(float xPercent, int y);
// these must be in document space (i.e. not scaled/zoomed).
- private native void nativeSetScrollOffset(int gen, int dx, int dy);
+ private native void nativeSetScrollOffset(int gen, int userScrolled, int dx, int dy);
private native void nativeSetGlobalBounds(int x, int y, int w, int h);