Merge "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." into froyo

This commit is contained in:
Grace Kloba
2010-04-20 11:40:07 -07:00
committed by Android (Google) Code Review

View File

@@ -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 {