Index: android_webview/java/src/org/chromium/android_webview/AwContents.java |
=================================================================== |
--- android_webview/java/src/org/chromium/android_webview/AwContents.java (revision 287507) |
+++ android_webview/java/src/org/chromium/android_webview/AwContents.java (working copy) |
@@ -1600,7 +1600,7 @@ |
if (!canZoomIn()) { |
return false; |
} |
- return mContentViewCore.pinchByDelta(1.25f); |
+ return zoomBy(1.25f); |
} |
/** |
@@ -1612,10 +1612,22 @@ |
if (!canZoomOut()) { |
return false; |
} |
- return mContentViewCore.pinchByDelta(0.8f); |
+ return zoomBy(0.8f); |
} |
/** |
+ * @see android.webkit.WebView#zoomBy() |
+ */ |
+ // This method uses the term 'zoom' for legacy reasons, but relates |
+ // to what chrome calls the 'page scale factor'. |
+ public boolean zoomBy(float delta) { |
+ if (delta < 0.01f || delta > 100.0f) { |
+ throw new IllegalStateException("zoom delta value outside [0.01, 100] range."); |
+ } |
+ return mContentViewCore.pinchByDelta(delta); |
+ } |
+ |
+ /** |
* @see android.webkit.WebView#invokeZoomPicker() |
*/ |
public void invokeZoomPicker() { |
@@ -2076,9 +2088,6 @@ |
if (mPageScaleFactor != pageScaleFactor) { |
float oldPageScaleFactor = mPageScaleFactor; |
mPageScaleFactor = pageScaleFactor; |
- // NOTE: if this ever needs to become synchronous then we need to make sure the scroll |
- // bounds are correctly updated before calling the method, otherwise embedder code that |
- // attempts to scroll on scale change might cause weird results. |
mContentsClient.getCallbackHelper().postOnScaleChangedScaled( |
(float)(oldPageScaleFactor * mDIPScale), |
(float)(mPageScaleFactor * mDIPScale)); |