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
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index 4f2830b..1eb3fa4 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -397,6 +397,7 @@
notify();
}
}
+ mWebView.dismissZoomControl();
}
break;
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 8ce6276..8603872 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3986,8 +3986,7 @@
protected void onDetachedFromWindow() {
clearTextEntry(false);
super.onDetachedFromWindow();
- // Clean up the zoom controller
- mZoomButtonsController.setVisible(false);
+ dismissZoomControl();
}
/**
@@ -4186,6 +4185,8 @@
}
}
+ 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 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 @@
}
}
+ 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 @@
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)) {