diff options
| author | 2011-04-27 10:46:39 -0700 | |
|---|---|---|
| committer | 2011-04-27 10:46:39 -0700 | |
| commit | 3bd929579919999852c3e29c536fd06907e620ac (patch) | |
| tree | e473759fbf19a69f6cd415970d2e31c1d0a45e4d | |
| parent | 1bde6f428e8742cbd8cc72c26967d32f10979694 (diff) | |
| parent | 7818aaa14a04661bdfd7019bdd1904c4383cd40f (diff) | |
Merge "Add support for force-enabling zoom"
| -rw-r--r-- | core/java/android/webkit/WebSettings.java | 18 | ||||
| -rw-r--r-- | core/java/android/webkit/WebViewCore.java | 29 |
2 files changed, 43 insertions, 4 deletions
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index 71d6080287c4..3e11197df764 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -219,6 +219,7 @@ public class WebSettings { private boolean mAllowContentAccess = true; private boolean mLoadWithOverviewMode = false; private boolean mEnableSmoothTransition = false; + private boolean mForceUserScalable = false; // AutoFill Profile data /** @@ -1658,6 +1659,23 @@ public class WebSettings { } } + /** + * Returns whether the viewport metatag can disable zooming + * @hide + */ + public boolean forceUserScalable() { + return mForceUserScalable; + } + + /** + * Sets whether viewport metatag can disable zooming. + * @param flag Whether or not to forceably enable user scalable. + * @hide + */ + public synchronized void setForceUserScalable(boolean flag) { + mForceUserScalable = flag; + } + synchronized void setSyntheticLinksEnabled(boolean flag) { if (mSyntheticLinksEnabled != flag) { mSyntheticLinksEnabled = flag; diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 027169597921..09205a529050 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -2253,6 +2253,27 @@ final class WebViewCore { // set the viewport settings from WebKit setViewportSettingsFromNative(); + if (mSettings.forceUserScalable()) { + mViewportUserScalable = true; + if (mViewportInitialScale > 0) { + if (mViewportMinimumScale > 0) { + mViewportMinimumScale = Math.min(mViewportMinimumScale, + mViewportInitialScale / 2); + } + if (mViewportMaximumScale > 0) { + mViewportMaximumScale = Math.max(mViewportMaximumScale, + mViewportInitialScale * 2); + } + } else { + if (mViewportMinimumScale > 0) { + mViewportMinimumScale = Math.min(mViewportMinimumScale, 50); + } + if (mViewportMaximumScale > 0) { + mViewportMaximumScale = Math.max(mViewportMaximumScale, 200); + } + } + } + // adjust the default scale to match the densityDpi float adjust = 1.0f; if (mViewportDensityDpi == -1) { @@ -2589,11 +2610,11 @@ final class WebViewCore { // called by JNI private Class<?> getPluginClass(String libName, String clsName) { - + if (mWebView == null) { return null; } - + PluginManager pluginManager = PluginManager.getInstance(null); String pkgName = pluginManager.getPluginsAPKName(libName); @@ -2601,7 +2622,7 @@ final class WebViewCore { Log.w(LOGTAG, "Unable to resolve " + libName + " to a plugin APK"); return null; } - + try { return pluginManager.getPluginClass(pkgName, clsName); } catch (NameNotFoundException e) { @@ -2656,7 +2677,7 @@ final class WebViewCore { view.mView = pluginView; return view; } - + // called by JNI. PluginWidget functions for creating an embedded View for // the surface drawing model. private ViewManager.ChildView addSurface(View pluginView, int x, int y, |