[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / common / page_zoom.cc
blobaf448aa421e17b834d0a7d734fbcd0f49d5d526a
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include <cmath>
7 #include "content/public/common/page_zoom.h"
9 namespace content {
11 const double kMinimumZoomFactor = 0.25;
12 const double kMaximumZoomFactor = 5.0;
13 const double kEpsilon = 0.001;
14 const double kTextSizeMultiplierRatio = 1.2;
16 bool ZoomValuesEqual(double value_a, double value_b) {
17 return (std::fabs(value_a - value_b) <= kEpsilon);
20 double ZoomLevelToZoomFactor(double zoom_level) {
21 return std::pow(kTextSizeMultiplierRatio, zoom_level);
24 double ZoomFactorToZoomLevel(double factor) {
25 return std::log(factor) / std::log(kTextSizeMultiplierRatio);
28 } // namespace content