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

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

Keep mobile site's text wrap scale unchanged.

issue: 3376306
Change-Id: Ifce67215486f09eadb34c30c085b0e502a5a8b05
parent 13271b41
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -846,22 +846,29 @@ class ZoomManager {
    public void onNewPicture(WebViewCore.DrawData drawData) {
        final int viewWidth = mWebView.getViewWidth();
        final boolean zoomOverviewWidthChanged = setupZoomOverviewWidth(drawData, viewWidth);
        final float newZoomOverviewScale = getZoomOverviewScale();
        WebSettings settings = mWebView.getSettings();
        if (zoomOverviewWidthChanged && settings.isNarrowColumnLayout() &&
            settings.getUseFixedViewport() &&
            (mInitialZoomOverview || mInZoomOverview)) {
            // Keep mobile site's text wrap scale unchanged.  For mobile sites,
            // the text wrap scale is the same as zoom overview scale, which is 1.0f.
            if (exceedsMinScaleIncrement(mTextWrapScale, 1.0f) ||
                    exceedsMinScaleIncrement(newZoomOverviewScale, 1.0f)) {
                mTextWrapScale = getReadingLevelScale();
            } else {
                mTextWrapScale = newZoomOverviewScale;
            }
        }

        final float zoomOverviewScale = getZoomOverviewScale();
        if (!mMinZoomScaleFixed) {
            mMinZoomScale = zoomOverviewScale;
            mMinZoomScale = newZoomOverviewScale;
        }
        // fit the content width to the current view. Ignore the rounding error case.
        if (!mWebView.drawHistory() && (mInitialZoomOverview || (mInZoomOverview
                && Math.abs((viewWidth * mInvActualScale) - mZoomOverviewWidth) > 1))) {
            mInitialZoomOverview = false;
            setZoomScale(zoomOverviewScale, !willScaleTriggerZoom(mTextWrapScale) &&
            setZoomScale(newZoomOverviewScale, !willScaleTriggerZoom(mTextWrapScale) &&
                !mWebView.getSettings().getUseFixedViewport());
        }
    }