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. 4 5#include <cmath> 6 7#include "content/public/common/page_zoom.h" 8 9namespace content { 10 11const double kMinimumZoomFactor = 0.25; 12const double kMaximumZoomFactor = 5.0; 13const double kEpsilon = 0.001; 14const double kTextSizeMultiplierRatio = 1.2; 15 16bool ZoomValuesEqual(double value_a, double value_b) { 17 return (std::fabs(value_a - value_b) <= kEpsilon); 18} 19 20double ZoomLevelToZoomFactor(double zoom_level) { 21 return std::pow(kTextSizeMultiplierRatio, zoom_level); 22} 23 24double ZoomFactorToZoomLevel(double factor) { 25 return std::log(factor) / std::log(kTextSizeMultiplierRatio); 26} 27 28} // namespace content 29