@@ -8733,27 +8733,6 @@ void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {
87338733 isPictureAfterFirstLayout , registerPageSwapCallback );
87348734 }
87358735 final Point viewSize = draw .mViewSize ;
8736- if (isPictureAfterFirstLayout ) {
8737- // Reset the last sent data here since dealing with new page.
8738- mLastWidthSent = 0 ;
8739- mZoomManager .onFirstLayout (draw );
8740- if (!mDrawHistory ) {
8741- // Do not send the scroll event for this particular
8742- // scroll message. Note that a scroll event may
8743- // still be fired if the user scrolls before the
8744- // message can be handled.
8745- mSendScrollEvent = false ;
8746- setContentScrollTo (viewState .mScrollX , viewState .mScrollY );
8747- mSendScrollEvent = true ;
8748-
8749- // As we are on a new page, remove the WebTextView. This
8750- // is necessary for page loads driven by webkit, and in
8751- // particular when the user was on a password field, so
8752- // the WebTextView was visible.
8753- clearTextEntry ();
8754- }
8755- }
8756-
87578736 // We update the layout (i.e. request a layout from the
87588737 // view system) if the last view size that we sent to
87598738 // WebCore matches the view size of the picture we just
@@ -8766,7 +8745,25 @@ void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {
87668745 mSendScrollEvent = false ;
87678746 recordNewContentSize (draw .mContentSize .x ,
87688747 draw .mContentSize .y , updateLayout );
8748+
8749+ if (isPictureAfterFirstLayout ) {
8750+ // Reset the last sent data here since dealing with new page.
8751+ mLastWidthSent = 0 ;
8752+ mZoomManager .onFirstLayout (draw );
8753+ int scrollX = viewState .mShouldStartScrolledRight
8754+ ? getContentWidth () : viewState .mScrollX ;
8755+ int scrollY = viewState .mScrollY ;
8756+ setContentScrollTo (scrollX , scrollY );
8757+ if (!mDrawHistory ) {
8758+ // As we are on a new page, remove the WebTextView. This
8759+ // is necessary for page loads driven by webkit, and in
8760+ // particular when the user was on a password field, so
8761+ // the WebTextView was visible.
8762+ clearTextEntry ();
8763+ }
8764+ }
87698765 mSendScrollEvent = true ;
8766+
87708767 if (DebugFlags .WEB_VIEW ) {
87718768 Rect b = draw .mInvalRegion .getBounds ();
87728769 Log .v (LOGTAG , "NEW_PICTURE_MSG_ID {" +
0 commit comments