@@ -145,11 +145,11 @@ class ZoomManager {
145145 private float mInvDefaultScale ;
146146
147147 /*
148- * The scale factor that is used to determine the zoom level for reading text.
149- * The value is initially set to equal the display density.
150- * TODO: Support changing this in WebSettings
148+ * The logical density of the display. This is a scaling factor for the
149+ * Density Independent Pixel unit, where one DIP is one pixel on an
150+ * approximately 160 dpi screen (see android.util.DisplayMetrics.density)
151151 */
152- private float mReadingLevelScale ;
152+ private float mDisplayDensity ;
153153
154154 /*
155155 * The scale factor that is used as the minimum increment when going from
@@ -233,11 +233,11 @@ public ZoomManager(WebView webView, CallbackProxy callbackProxy) {
233233 public void init (float density ) {
234234 assert density > 0 ;
235235
236+ mDisplayDensity = density ;
236237 setDefaultZoomScale (density );
237238 mActualScale = density ;
238239 mInvActualScale = 1 / density ;
239- mReadingLevelScale = density ;
240- mTextWrapScale = density ;
240+ mTextWrapScale = getReadingLevelScale ();
241241 }
242242
243243 /**
@@ -310,8 +310,11 @@ public final float getDefaultScale() {
310310 return mInitialScale > 0 ? mInitialScale : mDefaultScale ;
311311 }
312312
313+ /**
314+ * Returns the zoom scale used for reading text on a double-tap.
315+ */
313316 public final float getReadingLevelScale () {
314- return mReadingLevelScale ;
317+ return mDisplayDensity * mWebView . getSettings (). getDoubleTapZoom () / 100.0f ;
315318 }
316319
317320 public final float getInvDefaultScale () {
@@ -510,6 +513,13 @@ public boolean isFixedLengthAnimationInProgress() {
510513 return mZoomScale != 0 || mInHWAcceleratedZoom ;
511514 }
512515
516+ public void updateDoubleTapZoom () {
517+ if (mInZoomOverview ) {
518+ mTextWrapScale = getReadingLevelScale ();
519+ refreshZoomScale (true );
520+ }
521+ }
522+
513523 public void refreshZoomScale (boolean reflowText ) {
514524 setZoomScale (mActualScale , reflowText , true );
515525 }
0 commit comments