Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / content / public / common / page_zoom.h
blobaa5e56a90711b089987afdbcf17eafd49ddf67e2
1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_
6 #define CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_
8 #include "content/common/content_export.h"
10 namespace content {
12 // This enum is the parameter to various text/page zoom commands so we know
13 // what the specific zoom command is.
14 enum PageZoom {
15 PAGE_ZOOM_OUT = -1,
16 PAGE_ZOOM_RESET = 0,
17 PAGE_ZOOM_IN = 1,
20 // The minimum zoom factor permitted for a page. This is an alternative to
21 // WebView::minTextSizeMultiplier.
22 CONTENT_EXPORT extern const double kMinimumZoomFactor;
24 // The maximum zoom factor permitted for a page. This is an alternative to
25 // WebView::maxTextSizeMultiplier.
26 CONTENT_EXPORT extern const double kMaximumZoomFactor;
28 // Epsilon value for comparing two floating-point zoom values. We don't use
29 // std::numeric_limits<> because it is too precise for zoom values. Zoom
30 // values lose precision due to factor/level conversions. A value of 0.001
31 // is precise enough for zoom value comparisons.
32 CONTENT_EXPORT extern const double kEpsilon;
34 // Test if two zoom values (either zoom factors or zoom levels) should be
35 // considered equal.
36 CONTENT_EXPORT bool ZoomValuesEqual(double value_a, double value_b);
38 // Converts between zoom factors and levels.
39 CONTENT_EXPORT double ZoomLevelToZoomFactor(double zoom_level);
40 CONTENT_EXPORT double ZoomFactorToZoomLevel(double factor);
42 } // namespace content
44 #endif // CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_