Merge "Revert change to setInitialScale() to take display density into account." into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
4fdfdeedc6
@@ -799,7 +799,7 @@ public class WebSettings {
|
||||
public void setDefaultZoom(ZoomDensity zoom) {
|
||||
if (mDefaultZoom != zoom) {
|
||||
mDefaultZoom = zoom;
|
||||
mWebView.updateDefaultZoomDensity(zoom.value);
|
||||
mWebView.adjustDefaultZoomDensity(zoom.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1341,9 +1341,13 @@ public class WebView extends AbsoluteLayout
|
||||
}
|
||||
}
|
||||
|
||||
/* package */void updateDefaultZoomDensity(int zoomDensity) {
|
||||
/* package */ void adjustDefaultZoomDensity(int zoomDensity) {
|
||||
final float density = mContext.getResources().getDisplayMetrics().density
|
||||
* 100 / zoomDensity;
|
||||
updateDefaultZoomDensity(density);
|
||||
}
|
||||
|
||||
/* package */ void updateDefaultZoomDensity(float density) {
|
||||
mNavSlop = (int) (16 * density);
|
||||
mZoomManager.updateDefaultZoomDensity(density);
|
||||
}
|
||||
@@ -2469,7 +2473,9 @@ public class WebView extends AbsoluteLayout
|
||||
* Set the initial scale for the WebView. 0 means default. If
|
||||
* {@link WebSettings#getUseWideViewPort()} is true, it zooms out all the
|
||||
* way. Otherwise it starts with 100%. If initial scale is greater than 0,
|
||||
* WebView starts will this value as initial scale.
|
||||
* WebView starts with this value as initial scale.
|
||||
* Please note that unlike the scale properties in the viewport meta tag,
|
||||
* this method doesn't take the screen density into account.
|
||||
*
|
||||
* @param scaleInPercent The initial scale in percent.
|
||||
*/
|
||||
|
||||
@@ -2336,6 +2336,9 @@ public final class WebViewCore {
|
||||
adjust = (float) mContext.getResources().getDisplayMetrics().densityDpi
|
||||
/ mViewportDensityDpi;
|
||||
}
|
||||
if (adjust != mWebView.getDefaultZoomScale()) {
|
||||
mWebView.updateDefaultZoomDensity(adjust);
|
||||
}
|
||||
int defaultScale = (int) (adjust * 100);
|
||||
|
||||
if (mViewportInitialScale > 0) {
|
||||
@@ -2546,7 +2549,7 @@ public final class WebViewCore {
|
||||
// called by JNI
|
||||
private void restoreScale(float scale, float textWrapScale) {
|
||||
if (mBrowserFrame.firstLayoutDone() == false) {
|
||||
mIsRestored = scale > 0;
|
||||
mIsRestored = true;
|
||||
mRestoredScale = scale;
|
||||
if (mSettings.getUseWideViewPort()) {
|
||||
mRestoredTextWrapScale = textWrapScale;
|
||||
|
||||
@@ -349,7 +349,7 @@ class ZoomManager {
|
||||
}
|
||||
|
||||
public final void setInitialScaleInPercent(int scaleInPercent) {
|
||||
mInitialScale = scaleInPercent * mDisplayDensity * 0.01f;
|
||||
mInitialScale = scaleInPercent * 0.01f;
|
||||
}
|
||||
|
||||
public final float computeScaleWithLimits(float scale) {
|
||||
|
||||
Reference in New Issue
Block a user