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
return mAwContents.zoomOut();
}
// TODO(paulmiller) Return void for consistency with AwContents.zoomBy and WebView.zoomBy -
// tricky because frameworks WebViewProvider.zoomBy must change simultaneously
@Override
public boolean zoomBy(float factor) {
mFactory.startYourEngines(true);
// This is an L API and therefore we can enforce stricter threading constraints.
checkThread();
return mAwContents.zoomBy(factor);
mAwContents.zoomBy(factor);
return true;
}
@Override
......
......@@ -1710,7 +1710,8 @@ public class AwContents implements SmartClipProvider {
if (!canZoomIn()) {
return false;
}
return zoomBy(1.25f);
zoomBy(1.25f);
return true;
}
/**
......@@ -1722,7 +1723,8 @@ public class AwContents implements SmartClipProvider {
if (!canZoomOut()) {
return false;
}
return zoomBy(0.8f);
zoomBy(0.8f);
return true;
}
/**
......@@ -1730,12 +1732,12 @@ public class AwContents implements SmartClipProvider {
*/
// 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 (isDestroyed()) return false;
public void zoomBy(float delta) {
if (isDestroyed()) return;
if (delta < 0.01f || delta > 100.0f) {
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 {
private void zoomByOnUiThreadAndWait(final float delta) throws Throwable {
final float previousScale = getPixelScaleOnUiThread(mAwContents);
assertTrue(runTestOnUiThreadAndGetResult(new Callable<Boolean>() {
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public Boolean call() throws Exception {
return mAwContents.zoomBy(delta);
public void run() {
mAwContents.zoomBy(delta);
}
}));
});
// The zoom level is updated asynchronously.
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