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

Commit 72a1d2e1 authored by Shimeng (Simon) Wang's avatar Shimeng (Simon) Wang
Browse files

Keep initial zoom overview for non-standard load.

In case of non-standard load such as reload, currently the ZoomManager's
onFirstLayout will not be triggered, hence initial zoom overview will not
be set.

This change provides a fix to set initial zoom overview in case of
non-standard load for the new picture after first layout.

issue: 4975315
Change-Id: If2ba3e472f2bb7b6fc4c52024d18a66dc1e41a23
parent be768ee5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1950,6 +1950,7 @@ public final class WebViewCore {
    // mInitialViewState is set by didFirstLayout() and then reset in the
    // next webkitDraw after passing the state to the UI thread.
    private ViewState mInitialViewState = null;
    private boolean mFirstLayoutForNonStandardLoad;

    static class ViewState {
        float mMinScale;
@@ -1977,6 +1978,7 @@ public final class WebViewCore {
        int mMinPrefWidth;
        // only non-null if it is for the first picture set after the first layout
        ViewState mViewState;
        boolean mFirstLayoutForNonStandardLoad;
        boolean mFocusSizeChanged;
    }

@@ -2026,6 +2028,10 @@ public final class WebViewCore {
                draw.mViewState = mInitialViewState;
                mInitialViewState = null;
            }
            if (mFirstLayoutForNonStandardLoad) {
                draw.mFirstLayoutForNonStandardLoad = true;
                mFirstLayoutForNonStandardLoad = false;
            }
            if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw NEW_PICTURE_MSG_ID");
            Message.obtain(mWebView.mPrivateHandler,
                    WebView.NEW_PICTURE_MSG_ID, draw).sendToTarget();
@@ -2312,6 +2318,8 @@ public final class WebViewCore {

        // if mViewportWidth is 0, it means device-width, always update.
        if (mViewportWidth != 0 && !updateViewState) {
            // For non standard load, since updateViewState will be false.
            mFirstLayoutForNonStandardLoad = true;
            ViewState viewState = new ViewState();
            viewState.mMinScale = mViewportMinimumScale / 100.0f;
            viewState.mMaxScale = mViewportMaximumScale / 100.0f;
+5 −0
Original line number Diff line number Diff line
@@ -1024,6 +1024,11 @@ class ZoomManager {
        } else {
            mInZoomOverview = !scaleHasDiff;
        }
        if (drawData.mFirstLayoutForNonStandardLoad && settings.getLoadWithOverviewMode()) {
            // Set mInitialZoomOverview in case this is the first picture for non standard load,
            // so next new picture could be forced into overview mode if it's true.
            mInitialZoomOverview = mInZoomOverview;
        }
    }

    /**