Loading core/java/android/webkit/BrowserFrame.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1025,7 +1025,7 @@ class BrowserFrame extends Handler { } } private float density() { private float density() { return mContext.getResources().getDisplayMetrics().density; return WebViewCore.getFixedDisplayDensity(mContext); } } /** /** Loading core/java/android/webkit/WebViewClassic.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -1664,7 +1664,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc mTouchSlopSquare = slop * slop; mTouchSlopSquare = slop * slop; slop = configuration.getScaledDoubleTapSlop(); slop = configuration.getScaledDoubleTapSlop(); mDoubleTapSlopSquare = slop * slop; mDoubleTapSlopSquare = slop * slop; final float density = mContext.getResources().getDisplayMetrics().density; final float density = WebViewCore.getFixedDisplayDensity(mContext); // use one line height, 16 based on our current default font, for how // use one line height, 16 based on our current default font, for how // far we allow a touch be away from the edge of a link // far we allow a touch be away from the edge of a link mNavSlop = (int) (16 * density); mNavSlop = (int) (16 * density); Loading Loading @@ -1809,7 +1809,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc } } /* package */ void adjustDefaultZoomDensity(int zoomDensity) { /* package */ void adjustDefaultZoomDensity(int zoomDensity) { final float density = mContext.getResources().getDisplayMetrics().density final float density = WebViewCore.getFixedDisplayDensity(mContext) * 100 / zoomDensity; * 100 / zoomDensity; updateDefaultZoomDensity(density); updateDefaultZoomDensity(density); } } Loading core/java/android/webkit/WebViewCore.java +10 −4 Original line number Original line Diff line number Diff line Loading @@ -2479,6 +2479,13 @@ public final class WebViewCore { setupViewport(true); setupViewport(true); } } static float getFixedDisplayDensity(Context context) { // We make bad assumptions about multiplying and dividing density by 100, // force them to be true with this hack float density = context.getResources().getDisplayMetrics().density; return ((int) (density * 100)) / 100.0f; } private void setupViewport(boolean updateViewState) { private void setupViewport(boolean updateViewState) { if (mWebViewClassic == null || mSettings == null) { if (mWebViewClassic == null || mSettings == null) { // We've been destroyed or are being destroyed, return early // We've been destroyed or are being destroyed, return early Loading Loading @@ -2523,14 +2530,13 @@ public final class WebViewCore { // adjust the default scale to match the densityDpi // adjust the default scale to match the densityDpi float adjust = 1.0f; float adjust = 1.0f; if (mViewportDensityDpi == -1) { if (mViewportDensityDpi == -1) { adjust = mContext.getResources().getDisplayMetrics().density; adjust = getFixedDisplayDensity(mContext); } else if (mViewportDensityDpi > 0) { } else if (mViewportDensityDpi > 0) { adjust = (float) mContext.getResources().getDisplayMetrics().densityDpi adjust = (float) mContext.getResources().getDisplayMetrics().densityDpi / mViewportDensityDpi; / mViewportDensityDpi; } // We make bad assumptions about multiplying and dividing by 100, force // them to be true with this hack adjust = ((int) (adjust * 100)) / 100.0f; adjust = ((int) (adjust * 100)) / 100.0f; } // Remove any update density messages in flight. // Remove any update density messages in flight. // If the density is indeed different from WebView's default scale, // If the density is indeed different from WebView's default scale, // a new message will be queued. // a new message will be queued. Loading Loading
core/java/android/webkit/BrowserFrame.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1025,7 +1025,7 @@ class BrowserFrame extends Handler { } } private float density() { private float density() { return mContext.getResources().getDisplayMetrics().density; return WebViewCore.getFixedDisplayDensity(mContext); } } /** /** Loading
core/java/android/webkit/WebViewClassic.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -1664,7 +1664,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc mTouchSlopSquare = slop * slop; mTouchSlopSquare = slop * slop; slop = configuration.getScaledDoubleTapSlop(); slop = configuration.getScaledDoubleTapSlop(); mDoubleTapSlopSquare = slop * slop; mDoubleTapSlopSquare = slop * slop; final float density = mContext.getResources().getDisplayMetrics().density; final float density = WebViewCore.getFixedDisplayDensity(mContext); // use one line height, 16 based on our current default font, for how // use one line height, 16 based on our current default font, for how // far we allow a touch be away from the edge of a link // far we allow a touch be away from the edge of a link mNavSlop = (int) (16 * density); mNavSlop = (int) (16 * density); Loading Loading @@ -1809,7 +1809,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc } } /* package */ void adjustDefaultZoomDensity(int zoomDensity) { /* package */ void adjustDefaultZoomDensity(int zoomDensity) { final float density = mContext.getResources().getDisplayMetrics().density final float density = WebViewCore.getFixedDisplayDensity(mContext) * 100 / zoomDensity; * 100 / zoomDensity; updateDefaultZoomDensity(density); updateDefaultZoomDensity(density); } } Loading
core/java/android/webkit/WebViewCore.java +10 −4 Original line number Original line Diff line number Diff line Loading @@ -2479,6 +2479,13 @@ public final class WebViewCore { setupViewport(true); setupViewport(true); } } static float getFixedDisplayDensity(Context context) { // We make bad assumptions about multiplying and dividing density by 100, // force them to be true with this hack float density = context.getResources().getDisplayMetrics().density; return ((int) (density * 100)) / 100.0f; } private void setupViewport(boolean updateViewState) { private void setupViewport(boolean updateViewState) { if (mWebViewClassic == null || mSettings == null) { if (mWebViewClassic == null || mSettings == null) { // We've been destroyed or are being destroyed, return early // We've been destroyed or are being destroyed, return early Loading Loading @@ -2523,14 +2530,13 @@ public final class WebViewCore { // adjust the default scale to match the densityDpi // adjust the default scale to match the densityDpi float adjust = 1.0f; float adjust = 1.0f; if (mViewportDensityDpi == -1) { if (mViewportDensityDpi == -1) { adjust = mContext.getResources().getDisplayMetrics().density; adjust = getFixedDisplayDensity(mContext); } else if (mViewportDensityDpi > 0) { } else if (mViewportDensityDpi > 0) { adjust = (float) mContext.getResources().getDisplayMetrics().densityDpi adjust = (float) mContext.getResources().getDisplayMetrics().densityDpi / mViewportDensityDpi; / mViewportDensityDpi; } // We make bad assumptions about multiplying and dividing by 100, force // them to be true with this hack adjust = ((int) (adjust * 100)) / 100.0f; adjust = ((int) (adjust * 100)) / 100.0f; } // Remove any update density messages in flight. // Remove any update density messages in flight. // If the density is indeed different from WebView's default scale, // If the density is indeed different from WebView's default scale, // a new message will be queued. // a new message will be queued. Loading