Commit f4dbf977 authored by thestig@chromium.org's avatar thestig@chromium.org

PPAPI: Don't round zoom levels to the nearest integer.

BUG=106231
TEST=none

Review URL: http://codereview.chromium.org/8784008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113034 0039d316-1c4b-4281-b951-d872f2087c98
parent 7664efd2
......@@ -1846,18 +1846,7 @@ void PluginInstance::ZoomChanged(PP_Instance instance, double factor) {
// plugin. If we're in an iframe, then don't do anything.
if (!IsFullPagePlugin())
return;
double zoom_level = WebView::zoomFactorToZoomLevel(factor);
// The conversino from zoom level to factor, and back, can introduce rounding
// errors. i.e. WebKit originally tells us 3.0, but by the time we tell the
// plugin and it tells us back, the level becomes 3.000000000004. Need to
// round or else otherwise if the user zooms out, it will go to 3.0 instead of
// 2.0.
int rounded =
static_cast<int>(zoom_level + (zoom_level > 0 ? 0.001 : -0.001));
if (abs(rounded - zoom_level) < 0.001)
zoom_level = rounded;
container()->zoomLevelChanged(zoom_level);
container()->zoomLevelChanged(WebView::zoomFactorToZoomLevel(factor));
}
void PluginInstance::ZoomLimitsChanged(PP_Instance instance,
......
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