Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: content/common/page_zoom.cc

Issue 8926001: Move some zoom constants into the headers so we don't have to duplicate the values in plugins. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chrome_page_zoom.cc ('k') | content/public/common/page_zoom.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 6
7 #include "content/public/common/page_zoom.h" 7 #include "content/public/common/page_zoom.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 const double kMinimumZoomFactor = 0.25; 11 const double kMinimumZoomFactor = 0.25;
12 const double kMaximumZoomFactor = 5.0; 12 const double kMaximumZoomFactor = 5.0;
13 const double kEpsilon = 0.001;
13 14
14 bool ZoomValuesEqual(double value_a, double value_b) { 15 bool ZoomValuesEqual(double value_a, double value_b) {
15 // Epsilon value for comparing two floating-point zoom values. We don't use 16 return (std::fabs(value_a - value_b) <= kEpsilon);
16 // std::numeric_limits<> because it is too precise for zoom values. Zoom
17 // values lose precision due to factor/level conversions. A value of 0.001
18 // is precise enough for zoom value comparisons.
19 const double epsilon = 0.001;
20
21 return (std::fabs(value_a - value_b) <= epsilon);
22 } 17 }
23 18
24 } // namespace content 19 } // namespace content
25
OLDNEW
« no previous file with comments | « chrome/browser/chrome_page_zoom.cc ('k') | content/public/common/page_zoom.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698