diff options
author | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-28 13:47:54 +0000 |
---|---|---|
committer | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-28 13:47:54 +0000 |
commit | 1d7c8e031c589b3f4b9707460976c26a7e687019 (patch) | |
tree | f2378e6564d76637e08b648c177ad667c1481920 /android_webview/java | |
parent | da116732d15bbe8ffc7db3c1d7de6ace7b8effaa (diff) | |
download | chromium_src-1d7c8e031c589b3f4b9707460976c26a7e687019.zip chromium_src-1d7c8e031c589b3f4b9707460976c26a7e687019.tar.gz chromium_src-1d7c8e031c589b3f4b9707460976c26a7e687019.tar.bz2 |
[Android WebView] Implement WebView.setInitialScale
WebView.setInitialScale allows to set up the initial page scale
which overrides viewport meta tag settings.
Review URL: https://chromiumcodereview.appspot.com/12315104
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185236 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/java')
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwSettings.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwSettings.java b/android_webview/java/src/org/chromium/android_webview/AwSettings.java index 3ff16e2..7af9eaf 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java +++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java @@ -160,6 +160,22 @@ public class AwSettings { } /** + * Sets the initial scale for this WebView. The default value + * is -1. A non-default value overrides initial scale set by + * the meta viewport tag. + */ + public void setInitialPageScale(final float scaleInPercent) { + // There is no need to lock, because the native code doesn't + // read anything from the Java side. + ThreadUtils.runOnUiThread(new Runnable() { + @Override + public void run() { + nativeSetInitialPageScale(mNativeAwSettings, scaleInPercent); + } + }); + } + + /** * Sets the text zoom of the page in percent. This kind of zooming is * only applicable when Text Autosizing is turned off. Passing -1 will * reset the zoom to the default value. @@ -216,5 +232,7 @@ public class AwSettings { private native void nativeSetEnableFixedLayoutMode(int nativeAwSettings, boolean enable); + private native void nativeSetInitialPageScale(int nativeAwSettings, float scaleInPercent); + private native void nativeSetTextZoom(int nativeAwSettings, int textZoom); } |