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

Commit 21817f6e authored by Grace Kloba's avatar Grace Kloba
Browse files

Explicitly dismiss the zoom control if

 1. start double tap
 2. start pinch
 3. start a popup window
 4. about to detach from window
 5. WebView size change which happens when IME is up
    or rotation changed.

Partial fix http://b/issue?id=2530401. Dismiss the
zoom control of the main window when bringing up
the sub window
parent 1bb63afc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -397,6 +397,7 @@ class CallbackProxy extends Handler {
                            notify();
                        }
                    }
                    mWebView.dismissZoomControl();
                }
                break;

+22 −18
Original line number Diff line number Diff line
@@ -3986,8 +3986,7 @@ public class WebView extends AbsoluteLayout
    protected void onDetachedFromWindow() {
        clearTextEntry(false);
        super.onDetachedFromWindow();
        // Clean up the zoom controller
        mZoomButtonsController.setVisible(false);
        dismissZoomControl();
    }

    /**
@@ -4186,6 +4185,8 @@ public class WebView extends AbsoluteLayout
            }
        }

        dismissZoomControl();

        // onSizeChanged() is called during WebView layout. And any
        // requestLayout() is blocked during layout. As setNewZoomScale() will
        // call its child View to reposition itself through ViewManager's
@@ -4447,9 +4448,7 @@ public class WebView extends AbsoluteLayout
        public boolean onScaleBegin(ScaleGestureDetector detector) {
            // cancel the single touch handling
            cancelTouch();
            if (mZoomButtonsController.isVisible()) {
                mZoomButtonsController.setVisible(false);
            }
            dismissZoomControl();
            // reset the zoom overview mode so that the page won't auto grow
            mInZoomOverview = false;
            // If it is in password mode, turn it off so it does not draw
@@ -5782,6 +5781,22 @@ public class WebView extends AbsoluteLayout
        }
    }

    void dismissZoomControl() {
        WebSettings settings = getSettings();
        if (settings.getBuiltInZoomControls()) {
            if (mZoomButtonsController.isVisible()) {
                mZoomButtonsController.setVisible(false);
            }
        } else {
            if (mZoomControlRunnable != null) {
                mPrivateHandler.removeCallbacks(mZoomControlRunnable);
            }
            if (mZoomControls != null) {
                mZoomControls.hide();
            }
        }
    }

    // Rule for double tap:
    // 1. if the current scale is not same as the text wrap scale and layout
    //    algorithm is NARROW_COLUMNS, fit to column;
@@ -5796,20 +5811,9 @@ public class WebView extends AbsoluteLayout
        mAnchorX = viewToContentX((int) mZoomCenterX + mScrollX);
        mAnchorY = viewToContentY((int) mZoomCenterY + mScrollY);
        WebSettings settings = getSettings();
        // remove the zoom control after double tap
        if (settings.getBuiltInZoomControls()) {
            if (mZoomButtonsController.isVisible()) {
                mZoomButtonsController.setVisible(false);
            }
        } else {
            if (mZoomControlRunnable != null) {
                mPrivateHandler.removeCallbacks(mZoomControlRunnable);
            }
            if (mZoomControls != null) {
                mZoomControls.hide();
            }
        }
        settings.setDoubleTapToastCount(0);
        // remove the zoom control after double tap
        dismissZoomControl();
        ViewManager.ChildView plugin = mViewManager.hitTest(mAnchorX, mAnchorY);
        if (plugin != null) {
            if (isPluginFitOnScreen(plugin)) {