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-2013 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 }; | 59 }; |
60 | 60 |
61 ViewportDescription(Type type = UserAgentStyleSheet) | 61 ViewportDescription(Type type = UserAgentStyleSheet) |
62 : type(type) | 62 : type(type) |
63 , zoom(ValueAuto) | 63 , zoom(ValueAuto) |
64 , minZoom(ValueAuto) | 64 , minZoom(ValueAuto) |
65 , maxZoom(ValueAuto) | 65 , maxZoom(ValueAuto) |
66 , userZoom(true) | 66 , userZoom(true) |
67 , orientation(ValueAuto) | 67 , orientation(ValueAuto) |
68 , deprecatedTargetDensityDPI(ValueAuto) | 68 , deprecatedTargetDensityDPI(ValueAuto) |
69 , minimalUI(false) | 69 , zoomIsExplicit(false) |
| 70 , minZoomIsExplicit(false) |
| 71 , maxZoomIsExplicit(false) |
| 72 , userZoomIsExplicit(false) |
70 { | 73 { |
71 } | 74 } |
72 | 75 |
73 // All arguments are in CSS units. | 76 // All arguments are in CSS units. |
74 PageScaleConstraints resolve(const FloatSize& initialViewportSize, Length le
gacyFallbackWidth) const; | 77 PageScaleConstraints resolve(const FloatSize& initialViewportSize, Length le
gacyFallbackWidth) const; |
75 | 78 |
76 Length minWidth; | 79 Length minWidth; |
77 Length maxWidth; | 80 Length maxWidth; |
78 Length minHeight; | 81 Length minHeight; |
79 Length maxHeight; | 82 Length maxHeight; |
80 float zoom; | 83 float zoom; |
81 float minZoom; | 84 float minZoom; |
82 float maxZoom; | 85 float maxZoom; |
83 bool userZoom; | 86 bool userZoom; |
84 float orientation; | 87 float orientation; |
85 float deprecatedTargetDensityDPI; // Only used for Android WebView | 88 float deprecatedTargetDensityDPI; // Only used for Android WebView |
86 bool minimalUI; | 89 |
| 90 // Whether the computed value was explicitly specified rather than being |
| 91 // inferred. |
| 92 bool zoomIsExplicit; |
| 93 bool minZoomIsExplicit; |
| 94 bool maxZoomIsExplicit; |
| 95 bool userZoomIsExplicit; |
87 | 96 |
88 bool operator==(const ViewportDescription& other) const | 97 bool operator==(const ViewportDescription& other) const |
89 { | 98 { |
90 // Used for figuring out whether to reset the viewport or not, | 99 // Used for figuring out whether to reset the viewport or not, |
91 // thus we are not taking type into account. | 100 // thus we are not taking type into account. |
92 return minWidth == other.minWidth | 101 return minWidth == other.minWidth |
93 && maxWidth == other.maxWidth | 102 && maxWidth == other.maxWidth |
94 && minHeight == other.minHeight | 103 && minHeight == other.minHeight |
95 && maxHeight == other.maxHeight | 104 && maxHeight == other.maxHeight |
96 && zoom == other.zoom | 105 && zoom == other.zoom |
97 && minZoom == other.minZoom | 106 && minZoom == other.minZoom |
98 && maxZoom == other.maxZoom | 107 && maxZoom == other.maxZoom |
99 && userZoom == other.userZoom | 108 && userZoom == other.userZoom |
100 && orientation == other.orientation | 109 && orientation == other.orientation |
101 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI | 110 && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI |
102 && minimalUI == other.minimalUI; | 111 && zoomIsExplicit == other.zoomIsExplicit |
| 112 && minZoomIsExplicit == other.minZoomIsExplicit |
| 113 && maxZoomIsExplicit == other.maxZoomIsExplicit |
| 114 && userZoomIsExplicit == other.userZoomIsExplicit; |
103 } | 115 } |
104 | 116 |
105 bool operator!=(const ViewportDescription& other) const | 117 bool operator!=(const ViewportDescription& other) const |
106 { | 118 { |
107 return !(*this == other); | 119 return !(*this == other); |
108 } | 120 } |
109 | 121 |
110 bool isLegacyViewportType() const { return type >= HandheldFriendlyMeta && t
ype <= ViewportMeta; } | 122 bool isLegacyViewportType() const { return type >= HandheldFriendlyMeta && t
ype <= ViewportMeta; } |
111 bool isMetaViewportType() const { return type == ViewportMeta; } | 123 bool isMetaViewportType() const { return type == ViewportMeta; } |
112 bool isSpecifiedByAuthor() const { return type != UserAgentStyleSheet; } | 124 bool isSpecifiedByAuthor() const { return type != UserAgentStyleSheet; } |
113 | 125 |
114 private: | 126 private: |
115 enum Direction { Horizontal, Vertical }; | 127 enum Direction { Horizontal, Vertical }; |
116 static float resolveViewportLength(const Length&, const FloatSize& initialVi
ewportSize, Direction); | 128 static float resolveViewportLength(const Length&, const FloatSize& initialVi
ewportSize, Direction); |
117 }; | 129 }; |
118 | 130 |
119 } // namespace WebCore | 131 } // namespace WebCore |
120 | 132 |
121 #endif // ViewportDescription_h | 133 #endif // ViewportDescription_h |
OLD | NEW |