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

Commit f4c66efa authored by Grace Kloba's avatar Grace Kloba
Browse files

Don't inflate the zoom button controller until we

are going to show it. This should shave 5% of Browser
start up time on Sapphire.

Fix http://b/issue?id=2604295
parent 3891c4cc
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -874,18 +874,18 @@ public class WebView extends AbsoluteLayout
    }

    private void updateZoomButtonsEnabled() {
        if (mZoomButtonsController == null) return;
        boolean canZoomIn = mActualScale < mMaxZoomScale;
        boolean canZoomOut = mActualScale > mMinZoomScale && !mInZoomOverview;
        ZoomButtonsController controller = getZoomButtonsController();
        if (!canZoomIn && !canZoomOut) {
            // Hide the zoom in and out buttons, as well as the fit to page
            // button, if the page cannot zoom
            controller.getZoomControls().setVisibility(View.GONE);
            mZoomButtonsController.getZoomControls().setVisibility(View.GONE);
        } else {
            // Set each one individually, as a page may be able to zoom in
            // or out.
            controller.setZoomInEnabled(canZoomIn);
            controller.setZoomOutEnabled(canZoomOut);
            mZoomButtonsController.setZoomInEnabled(canZoomIn);
            mZoomButtonsController.setZoomOutEnabled(canZoomOut);
        }
    }

@@ -4013,7 +4013,8 @@ public class WebView extends AbsoluteLayout
            }
        } else {
            if (mWebViewCore != null && getSettings().getBuiltInZoomControls()
                    && !getZoomButtonsController().isVisible()) {
                    && (mZoomButtonsController == null ||
                            !mZoomButtonsController.isVisible())) {
                /*
                 * The zoom controls come in their own window, so our window
                 * loses focus. Our policy is to not draw the cursor ring if
@@ -5842,7 +5843,7 @@ public class WebView extends AbsoluteLayout
        }
        WebSettings settings = getSettings();
        if (settings.getBuiltInZoomControls()) {
            if (getZoomButtonsController().isVisible()) {
            if (mZoomButtonsController != null) {
                mZoomButtonsController.setVisible(false);
            }
        } else {