From 331493085d7afd88158c83d0f1f9605da671049c Mon Sep 17 00:00:00 2001 From: George Mount Date: Mon, 31 Oct 2011 13:49:03 -0700 Subject: DO NOT MERGE Set the initial scroll position for RTL. Bug 5268793 Webkit knows about the correct initial position for web pages. On initial show, scroll to the webkit position. Cherry-picked from master CL: I2537b84a External WebKit CL: I6a91b97f Change-Id: I2537b84a30a26a79a8a0f23fe62b9ed757f9c5a4 --- core/java/android/webkit/WebView.java | 39 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'core/java/android/webkit/WebView.java') diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 55f345f..62eb683 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -8716,27 +8716,6 @@ public class WebView extends AbsoluteLayout isPictureAfterFirstLayout, registerPageSwapCallback); } final Point viewSize = draw.mViewSize; - if (isPictureAfterFirstLayout) { - // Reset the last sent data here since dealing with new page. - mLastWidthSent = 0; - mZoomManager.onFirstLayout(draw); - if (!mDrawHistory) { - // Do not send the scroll event for this particular - // scroll message. Note that a scroll event may - // still be fired if the user scrolls before the - // message can be handled. - mSendScrollEvent = false; - setContentScrollTo(viewState.mScrollX, viewState.mScrollY); - mSendScrollEvent = true; - - // As we are on a new page, remove the WebTextView. This - // is necessary for page loads driven by webkit, and in - // particular when the user was on a password field, so - // the WebTextView was visible. - clearTextEntry(); - } - } - // We update the layout (i.e. request a layout from the // view system) if the last view size that we sent to // WebCore matches the view size of the picture we just @@ -8749,7 +8728,25 @@ public class WebView extends AbsoluteLayout mSendScrollEvent = false; recordNewContentSize(draw.mContentSize.x, draw.mContentSize.y, updateLayout); + + if (isPictureAfterFirstLayout) { + // Reset the last sent data here since dealing with new page. + mLastWidthSent = 0; + mZoomManager.onFirstLayout(draw); + int scrollX = viewState.mShouldStartScrolledRight + ? getContentWidth() : viewState.mScrollX; + int scrollY = viewState.mScrollY; + setContentScrollTo(scrollX, scrollY); + if (!mDrawHistory) { + // As we are on a new page, remove the WebTextView. This + // is necessary for page loads driven by webkit, and in + // particular when the user was on a password field, so + // the WebTextView was visible. + clearTextEntry(); + } + } mSendScrollEvent = true; + if (DebugFlags.WEB_VIEW) { Rect b = draw.mInvalRegion.getBounds(); Log.v(LOGTAG, "NEW_PICTURE_MSG_ID {" + -- cgit v1.1