Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8645ff3d authored by George Mount's avatar George Mount Committed by Android Git Automerger
Browse files

am c60baec7: Merge "DO NOT MERGE Set the initial scroll position for RTL." into ics-mr1

* commit 'c60baec7':
  DO NOT MERGE Set the initial scroll position for RTL.
parents 58f3a712 c60baec7
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1404,4 +1404,17 @@ class BrowserFrame extends Handler {
    native void nativeSslClientCert(int handle,
                                    byte[] pkcs8EncodedPrivateKey,
                                    byte[][] asn1DerEncodedCertificateChain);

    /**
     * Returns true when the contents of the frame is an RTL or vertical-rl
     * page. This is used for determining whether a frame should be initially
     * scrolled right-most as opposed to left-most.
     * @return true when the frame should be initially scrolled right-most
     * based on the text direction and writing mode.
     */
    /* package */ boolean getShouldStartScrolledRight() {
        return nativeGetShouldStartScrolledRight(mNativeFrame);
    }

    private native boolean nativeGetShouldStartScrolledRight(int nativeBrowserFrame);
}
+18 −21
Original line number Diff line number Diff line
@@ -8733,27 +8733,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
@@ -8766,7 +8745,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 {" +
+7 −0
Original line number Diff line number Diff line
@@ -1982,6 +1982,7 @@ public final class WebViewCore {
        int mScrollY;
        boolean mMobileSite;
        boolean mIsRestored;
        boolean mShouldStartScrolledRight;
    }

    static class DrawData {
@@ -2382,6 +2383,7 @@ public final class WebViewCore {
            viewState.mMobileSite = false;
            // for non-mobile site, we don't need minPrefWidth, set it as 0
            viewState.mScrollX = 0;
            viewState.mShouldStartScrolledRight = false;
            Message.obtain(mWebView.mPrivateHandler,
                    WebView.UPDATE_ZOOM_RANGE, viewState).sendToTarget();
            return;
@@ -2412,6 +2414,11 @@ public final class WebViewCore {
        mInitialViewState.mDefaultScale = adjust;
        mInitialViewState.mScrollX = mRestoredX;
        mInitialViewState.mScrollY = mRestoredY;
        mInitialViewState.mShouldStartScrolledRight = (mRestoredX == 0)
                && (mRestoredY == 0)
                && (mBrowserFrame != null)
                && mBrowserFrame.getShouldStartScrolledRight();

        mInitialViewState.mMobileSite = (0 == mViewportWidth);
        if (mIsRestored) {
            mInitialViewState.mIsRestored = true;