Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 445553002: Merge 281052 "[android_webview] Add a zoomBy method to AwContents." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/src/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698