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

Commit 6660740c authored by Grace Kloba's avatar Grace Kloba Committed by Android (Google) Code Review
Browse files

Merge "Expose canZoomIn and canZoomOut for WebView."

parents 10280fc8 6164ef1b
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -201419,6 +201419,28 @@
 visibility="public"
>
</method>
<method name="canZoomIn"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="canZoomOut"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="capturePicture"
 return="android.graphics.Picture"
 abstract="false"
+17 −3
Original line number Diff line number Diff line
@@ -2248,7 +2248,7 @@ public class WebView extends AbsoluteLayout
        if (mDrawHistory) {
            return mHistoryWidth;
        } else if (mHorizontalScrollBarMode == SCROLLBAR_ALWAYSOFF
                && mZoomManager.isZoomedOut()) {
                && !mZoomManager.canZoomOut()) {
            // only honor the scrollbar mode when it is at minimum zoom level
            return computeHorizontalScrollExtent();
        } else {
@@ -2262,7 +2262,7 @@ public class WebView extends AbsoluteLayout
        if (mDrawHistory) {
            return mHistoryHeight;
        } else if (mVerticalScrollBarMode == SCROLLBAR_ALWAYSOFF
                && mZoomManager.isZoomedOut()) {
                && !mZoomManager.canZoomOut()) {
            // only honor the scrollbar mode when it is at minimum zoom level
            return computeVerticalScrollExtent();
        } else {
@@ -4493,7 +4493,7 @@ public class WebView extends AbsoluteLayout
                mAnchorY = viewToContentY((int) mZoomManager.mZoomCenterY + mScrollY);
                // don't reflow when zoom in; when zoom out, do reflow if the
                // new scale is almost minimum scale;
                boolean reflowNow = mZoomManager.isZoomedOut()
                boolean reflowNow = !mZoomManager.canZoomOut()
                        || (mZoomManager.mActualScale <= 0.8 * mZoomManager.mTextWrapScale);
                // force zoom after mPreviewZoomOnly is set to false so that the
                // new view size will be passed to the WebKit
@@ -5556,6 +5556,20 @@ public class WebView extends AbsoluteLayout
        return mZoomManager.mDefaultScale;
    }

    /**
     * @return TRUE if the WebView can be zoomed in.
     */
    public boolean canZoomIn() {
        return mZoomManager.canZoomIn();
    }

    /**
     * @return TRUE if the WebView can be zoomed out.
     */
    public boolean canZoomOut() {
        return mZoomManager.canZoomOut();
    }

    /**
     * Perform zoom in in the webview
     * @return TRUE if zoom in succeeds. FALSE if no zoom changes.
+6 −2
Original line number Diff line number Diff line
@@ -138,8 +138,12 @@ class ZoomManager {
        return exceedsMinScaleIncrement(scale, mActualScale);
    }

    public boolean isZoomedOut() {
        return mActualScale - mMinZoomScale <= MINIMUM_SCALE_INCREMENT;
    public boolean canZoomIn() {
        return mMaxZoomScale - mActualScale > MINIMUM_SCALE_INCREMENT;
    }

    public boolean canZoomOut() {
        return mActualScale - mMinZoomScale > MINIMUM_SCALE_INCREMENT;
    }

    public boolean zoomIn() {