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

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

Issue 368023002: [android_webview] Add a zoomBy method to AwContents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 40e4d781b1ea28d09cc9e8f89902a88f5153ae74..ea2244dbef720df9c90d91511c908fef2e3d79c6 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -1602,7 +1602,7 @@ public class AwContents {
if (!canZoomIn()) {
return false;
}
- return mContentViewCore.pinchByDelta(1.25f);
+ return zoomBy(1.25f);
}
/**
@@ -1614,7 +1614,19 @@ public class AwContents {
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);
}
/**
@@ -2061,9 +2073,6 @@ public class AwContents {
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