OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 10 matching lines...) Expand all Loading... |
21 * You should have received a copy of the GNU Library General Public License | 21 * You should have received a copy of the GNU Library General Public License |
22 * along with this library; see the file COPYING.LIB. If not, write to | 22 * along with this library; see the file COPYING.LIB. If not, write to |
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 * Boston, MA 02110-1301, USA. | 24 * Boston, MA 02110-1301, USA. |
25 * | 25 * |
26 */ | 26 */ |
27 | 27 |
28 #ifndef ViewportArguments_h | 28 #ifndef ViewportArguments_h |
29 #define ViewportArguments_h | 29 #define ViewportArguments_h |
30 | 30 |
| 31 #include "core/page/PageScaleConstraints.h" |
31 #include "core/platform/graphics/FloatSize.h" | 32 #include "core/platform/graphics/FloatSize.h" |
32 #include <wtf/Forward.h> | 33 #include <wtf/Forward.h> |
33 | 34 |
34 namespace WebCore { | 35 namespace WebCore { |
35 | 36 |
36 class Document; | 37 class Document; |
37 | 38 |
38 enum ViewportErrorCode { | 39 enum ViewportErrorCode { |
39 UnrecognizedViewportArgumentKeyError, | 40 UnrecognizedViewportArgumentKeyError, |
40 UnrecognizedViewportArgumentValueError, | 41 UnrecognizedViewportArgumentValueError, |
41 TruncatedViewportArgumentValueError, | 42 TruncatedViewportArgumentValueError, |
42 MaximumScaleTooLargeError, | 43 MaximumScaleTooLargeError, |
43 TargetDensityDpiUnsupported | 44 TargetDensityDpiUnsupported |
44 }; | 45 }; |
45 | 46 |
46 struct ViewportAttributes { | |
47 FloatSize layoutSize; | |
48 | |
49 float initialScale; | |
50 float minimumScale; | |
51 float maximumScale; | |
52 | |
53 float userScalable; | |
54 float orientation; | |
55 }; | |
56 | |
57 struct ViewportArguments { | 47 struct ViewportArguments { |
58 | 48 |
59 enum Type { | 49 enum Type { |
60 // These are ordered in increasing importance. | 50 // These are ordered in increasing importance. |
61 Implicit, | 51 Implicit, |
62 XHTMLMobileProfile, | 52 XHTMLMobileProfile, |
63 HandheldFriendlyMeta, | 53 HandheldFriendlyMeta, |
64 MobileOptimizedMeta, | 54 MobileOptimizedMeta, |
65 ViewportMeta, | 55 ViewportMeta, |
66 CSSDeviceAdaptation | 56 CSSDeviceAdaptation |
(...skipping 22 matching lines...) Expand all Loading... |
89 , zoom(ValueAuto) | 79 , zoom(ValueAuto) |
90 , minZoom(ValueAuto) | 80 , minZoom(ValueAuto) |
91 , maxZoom(ValueAuto) | 81 , maxZoom(ValueAuto) |
92 , userZoom(ValueAuto) | 82 , userZoom(ValueAuto) |
93 , orientation(ValueAuto) | 83 , orientation(ValueAuto) |
94 , deprecatedTargetDensityDPI(ValueAuto) | 84 , deprecatedTargetDensityDPI(ValueAuto) |
95 { | 85 { |
96 } | 86 } |
97 | 87 |
98 // All arguments are in CSS units. | 88 // All arguments are in CSS units. |
99 ViewportAttributes resolve(const FloatSize& initialViewportSize, const Float
Size& deviceSize, int defaultWidth) const; | 89 PageScaleConstraints resolve(const FloatSize& initialViewportSize, const Flo
atSize& deviceSize, int defaultWidth) const; |
100 | 90 |
101 float width; | 91 float width; |
102 float minWidth; | 92 float minWidth; |
103 float maxWidth; | 93 float maxWidth; |
104 float height; | 94 float height; |
105 float minHeight; | 95 float minHeight; |
106 float maxHeight; | 96 float maxHeight; |
107 float zoom; | 97 float zoom; |
108 float minZoom; | 98 float minZoom; |
109 float maxZoom; | 99 float maxZoom; |
(...skipping 16 matching lines...) Expand all Loading... |
126 && maxZoom == other.maxZoom | 116 && maxZoom == other.maxZoom |
127 && userZoom == other.userZoom | 117 && userZoom == other.userZoom |
128 && orientation == other.orientation | 118 && orientation == other.orientation |
129 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI; | 119 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI; |
130 } | 120 } |
131 | 121 |
132 bool operator!=(const ViewportArguments& other) const | 122 bool operator!=(const ViewportArguments& other) const |
133 { | 123 { |
134 return !(*this == other); | 124 return !(*this == other); |
135 } | 125 } |
136 | |
137 // FIXME: We're going to keep this constant around until all embedders | |
138 // refactor their code to no longer need it. | |
139 static const float deprecatedTargetDPI; | |
140 }; | 126 }; |
141 | 127 |
142 ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktop
Width, int deviceWidth, int deviceHeight, float devicePixelRatio, IntSize visibl
eViewport); | |
143 | |
144 void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSiz
e visibleViewport, float devicePixelRatio); | |
145 void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& resu
lt); | |
146 float computeMinimumScaleFactorForContentContained(const ViewportAttributes& res
ult, const IntSize& viewportSize, const IntSize& contentSize); | |
147 | |
148 void setViewportFeature(const String& keyString, const String& valueString, Docu
ment*, void* data); | 128 void setViewportFeature(const String& keyString, const String& valueString, Docu
ment*, void* data); |
149 void reportViewportWarning(Document*, ViewportErrorCode, const String& replaceme
nt1, const String& replacement2); | 129 void reportViewportWarning(Document*, ViewportErrorCode, const String& replaceme
nt1, const String& replacement2); |
150 | 130 |
151 } // namespace WebCore | 131 } // namespace WebCore |
152 | 132 |
153 #endif // ViewportArguments_h | 133 #endif // ViewportArguments_h |
OLD | NEW |