Commit 5977b553 authored by paulmiller's avatar paulmiller Committed by Commit bot

Return void in zoomBy plumbing to match zoomBy public API

BUG=410900

Review URL: https://codereview.chromium.org/881383002

Cr-Commit-Position: refs/heads/master@{#313617}
parent f24e7573
...@@ -1448,12 +1448,15 @@ class WebViewChromium implements WebViewProvider, WebViewProvider.ScrollDelegate ...@@ -1448,12 +1448,15 @@ class WebViewChromium implements WebViewProvider, WebViewProvider.ScrollDelegate
return mAwContents.zoomOut(); return mAwContents.zoomOut();
} }
// TODO(paulmiller) Return void for consistency with AwContents.zoomBy and WebView.zoomBy -
// tricky because frameworks WebViewProvider.zoomBy must change simultaneously
@Override @Override
public boolean zoomBy(float factor) { public boolean zoomBy(float factor) {
mFactory.startYourEngines(true); mFactory.startYourEngines(true);
// This is an L API and therefore we can enforce stricter threading constraints. // This is an L API and therefore we can enforce stricter threading constraints.
checkThread(); checkThread();
return mAwContents.zoomBy(factor); mAwContents.zoomBy(factor);
return true;
} }
@Override @Override
......
...@@ -1710,7 +1710,8 @@ public class AwContents implements SmartClipProvider { ...@@ -1710,7 +1710,8 @@ public class AwContents implements SmartClipProvider {
if (!canZoomIn()) { if (!canZoomIn()) {
return false; return false;
} }
return zoomBy(1.25f); zoomBy(1.25f);
return true;
} }
/** /**
...@@ -1722,7 +1723,8 @@ public class AwContents implements SmartClipProvider { ...@@ -1722,7 +1723,8 @@ public class AwContents implements SmartClipProvider {
if (!canZoomOut()) { if (!canZoomOut()) {
return false; return false;
} }
return zoomBy(0.8f); zoomBy(0.8f);
return true;
} }
/** /**
...@@ -1730,12 +1732,12 @@ public class AwContents implements SmartClipProvider { ...@@ -1730,12 +1732,12 @@ public class AwContents implements SmartClipProvider {
*/ */
// This method uses the term 'zoom' for legacy reasons, but relates // This method uses the term 'zoom' for legacy reasons, but relates
// to what chrome calls the 'page scale factor'. // to what chrome calls the 'page scale factor'.
public boolean zoomBy(float delta) { public void zoomBy(float delta) {
if (isDestroyed()) return false; if (isDestroyed()) return;
if (delta < 0.01f || delta > 100.0f) { if (delta < 0.01f || delta > 100.0f) {
throw new IllegalStateException("zoom delta value outside [0.01, 100] range."); throw new IllegalStateException("zoom delta value outside [0.01, 100] range.");
} }
return mContentViewCore.pinchByDelta(delta); mContentViewCore.pinchByDelta(delta);
} }
/** /**
......
...@@ -120,12 +120,12 @@ public class AwZoomTest extends AwTestBase { ...@@ -120,12 +120,12 @@ public class AwZoomTest extends AwTestBase {
private void zoomByOnUiThreadAndWait(final float delta) throws Throwable { private void zoomByOnUiThreadAndWait(final float delta) throws Throwable {
final float previousScale = getPixelScaleOnUiThread(mAwContents); final float previousScale = getPixelScaleOnUiThread(mAwContents);
assertTrue(runTestOnUiThreadAndGetResult(new Callable<Boolean>() { ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override @Override
public Boolean call() throws Exception { public void run() {
return mAwContents.zoomBy(delta); mAwContents.zoomBy(delta);
} }
})); });
// The zoom level is updated asynchronously. // The zoom level is updated asynchronously.
waitForScaleChange(previousScale); waitForScaleChange(previousScale);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment