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, 2011 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. |
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 30 matching lines...) Expand all Loading... | |
41 return value2; | 41 return value2; |
42 | 42 |
43 if (value2 == ViewportArguments::ValueAuto) | 43 if (value2 == ViewportArguments::ValueAuto) |
44 return value1; | 44 return value1; |
45 | 45 |
46 return compare(value1, value2); | 46 return compare(value1, value2); |
47 } | 47 } |
48 | 48 |
49 static inline float clampLengthValue(float value) | 49 static inline float clampLengthValue(float value) |
50 { | 50 { |
51 ASSERT(value != ViewportArguments::ValueDeviceWidth); | |
52 ASSERT(value != ViewportArguments::ValueDeviceHeight); | |
53 | |
54 // Limits as defined in the css-device-adapt spec. | 51 // Limits as defined in the css-device-adapt spec. |
55 if (value != ViewportArguments::ValueAuto) | 52 if (value != ViewportArguments::ValueAuto) |
56 return min(float(10000), max(value, float(1))); | 53 return min(float(10000), max(value, float(1))); |
57 return value; | 54 return value; |
58 } | 55 } |
59 | 56 |
60 static inline float clampScaleValue(float value) | 57 static inline float clampScaleValue(float value) |
61 { | 58 { |
62 ASSERT(value != ViewportArguments::ValueDeviceWidth); | |
63 ASSERT(value != ViewportArguments::ValueDeviceHeight); | |
64 | |
65 // Limits as defined in the css-device-adapt spec. | 59 // Limits as defined in the css-device-adapt spec. |
66 if (value != ViewportArguments::ValueAuto) | 60 if (value != ViewportArguments::ValueAuto) |
67 return min(float(10), max(value, float(0.1))); | 61 return min(float(10), max(value, float(0.1))); |
68 return value; | 62 return value; |
69 } | 63 } |
70 | 64 |
71 PageScaleConstraints ViewportArguments::resolve(const FloatSize& initialViewport Size, int defaultWidth) const | 65 PageScaleConstraints ViewportArguments::resolve(const FloatSize& initialViewport Size) const |
72 { | 66 { |
73 float resultWidth = width; | 67 float resultWidth = ValueAuto; |
74 float resultMaxWidth = maxWidth; | 68 float resultMaxWidth = maxWidth; |
75 float resultMinWidth = minWidth; | 69 float resultMinWidth = minWidth; |
76 float resultHeight = height; | 70 float resultHeight = ValueAuto; |
77 float resultMinHeight = minHeight; | 71 float resultMinHeight = minHeight; |
78 float resultMaxHeight = maxHeight; | 72 float resultMaxHeight = maxHeight; |
79 | 73 |
80 float resultZoom = zoom; | 74 float resultZoom = zoom; |
81 float resultMinZoom = minZoom; | 75 float resultMinZoom = minZoom; |
82 float resultMaxZoom = maxZoom; | 76 float resultMaxZoom = maxZoom; |
83 float resultUserZoom = userZoom; | 77 float resultUserZoom = userZoom; |
84 | 78 |
85 if (type == ViewportArguments::CSSDeviceAdaptation) { | 79 if (resultMaxWidth == ValueDeviceWidth) |
80 resultMaxWidth = initialViewportSize.width(); | |
81 else if (resultMaxWidth == ValueDeviceHeight) | |
82 resultMaxWidth = initialViewportSize.height(); | |
86 | 83 |
87 // device-width/device-height not supported for @viewport. | 84 if (resultMaxHeight == ValueDeviceWidth) |
88 ASSERT(resultMinWidth != ViewportArguments::ValueDeviceWidth); | 85 resultMaxHeight = initialViewportSize.width(); |
89 ASSERT(resultMinWidth != ViewportArguments::ValueDeviceHeight); | 86 else if (resultMaxHeight == ValueDeviceHeight) |
90 ASSERT(resultMaxWidth != ViewportArguments::ValueDeviceWidth); | 87 resultMaxHeight = initialViewportSize.height(); |
91 ASSERT(resultMaxWidth != ViewportArguments::ValueDeviceHeight); | |
92 ASSERT(resultMinHeight != ViewportArguments::ValueDeviceWidth); | |
93 ASSERT(resultMinHeight != ViewportArguments::ValueDeviceHeight); | |
94 ASSERT(resultMaxHeight != ViewportArguments::ValueDeviceWidth); | |
95 ASSERT(resultMaxHeight != ViewportArguments::ValueDeviceHeight); | |
96 | 88 |
97 // 1. Resolve min-zoom and max-zoom values. | 89 // 1. Resolve min-zoom and max-zoom values. |
98 if (resultMinZoom != ViewportArguments::ValueAuto && resultMaxZoom != Vi ewportArguments::ValueAuto) | 90 if (resultMinZoom != ViewportArguments::ValueAuto && resultMaxZoom != Viewpo rtArguments::ValueAuto) |
99 resultMaxZoom = max(resultMinZoom, resultMaxZoom); | 91 resultMaxZoom = max(resultMinZoom, resultMaxZoom); |
100 | 92 |
101 // 2. Constrain zoom value to the [min-zoom, max-zoom] range. | 93 // 2. Constrain zoom value to the [min-zoom, max-zoom] range. |
102 if (resultZoom != ViewportArguments::ValueAuto) | 94 if (resultZoom != ViewportArguments::ValueAuto) |
103 resultZoom = compareIgnoringAuto(resultMinZoom, compareIgnoringAuto( resultMaxZoom, resultZoom, min), max); | 95 resultZoom = compareIgnoringAuto(resultMinZoom, compareIgnoringAuto(resu ltMaxZoom, resultZoom, min), max); |
104 | 96 |
105 float extendZoom = compareIgnoringAuto(resultZoom, resultMaxZoom, min); | 97 float extendZoom = compareIgnoringAuto(resultZoom, resultMaxZoom, min); |
106 | 98 |
107 if (extendZoom == ViewportArguments::ValueAuto) { | 99 // 3. Resolve non-"auto" lengths to pixel lengths. |
kenneth.r.christiansen
2013/09/02 09:14:16
So all this is the same as in my patch?
rune
2013/09/02 11:29:30
I have not actually diffed - can do that. I did no
| |
108 if (resultMaxWidth == ViewportArguments::ValueExtendToZoom) | 100 if (extendZoom == ViewportArguments::ValueAuto) { |
109 resultMaxWidth = ViewportArguments::ValueAuto; | 101 if (resultMaxWidth == ViewportArguments::ValueExtendToZoom) |
102 resultMaxWidth = ViewportArguments::ValueAuto; | |
110 | 103 |
111 if (resultMaxHeight == ViewportArguments::ValueExtendToZoom) | 104 if (resultMaxHeight == ViewportArguments::ValueExtendToZoom) |
112 resultMaxHeight = ViewportArguments::ValueAuto; | 105 resultMaxHeight = ViewportArguments::ValueAuto; |
113 | 106 |
114 if (resultMinWidth == ViewportArguments::ValueExtendToZoom) | 107 if (resultMinWidth == ViewportArguments::ValueExtendToZoom) |
115 resultMinWidth = resultMaxWidth; | 108 resultMinWidth = resultMaxWidth; |
116 | 109 |
117 if (resultMinHeight == ViewportArguments::ValueExtendToZoom) | 110 if (resultMinHeight == ViewportArguments::ValueExtendToZoom) |
118 resultMinHeight = resultMaxHeight; | 111 resultMinHeight = resultMaxHeight; |
119 } else { | 112 } else { |
120 float extendWidth = initialViewportSize.width() / extendZoom; | 113 float extendWidth = initialViewportSize.width() / extendZoom; |
121 float extendHeight = initialViewportSize.height() / extendZoom; | 114 float extendHeight = initialViewportSize.height() / extendZoom; |
122 | 115 |
123 if (resultMaxWidth == ViewportArguments::ValueExtendToZoom) | 116 if (resultMaxWidth == ViewportArguments::ValueExtendToZoom) |
124 resultMaxWidth = extendWidth; | 117 resultMaxWidth = extendWidth; |
125 | 118 |
126 if (resultMaxHeight == ViewportArguments::ValueExtendToZoom) | 119 if (resultMaxHeight == ViewportArguments::ValueExtendToZoom) |
127 resultMaxHeight = extendHeight; | 120 resultMaxHeight = extendHeight; |
128 | 121 |
129 if (resultMinWidth == ViewportArguments::ValueExtendToZoom) | 122 if (resultMinWidth == ViewportArguments::ValueExtendToZoom) |
130 resultMinWidth = compareIgnoringAuto(extendWidth, resultMaxWidth , max); | 123 resultMinWidth = compareIgnoringAuto(extendWidth, resultMaxWidth, ma x); |
131 | 124 |
132 if (resultMinHeight == ViewportArguments::ValueExtendToZoom) | 125 if (resultMinHeight == ViewportArguments::ValueExtendToZoom) |
133 resultMinHeight = compareIgnoringAuto(extendHeight, resultMaxHei ght, max); | 126 resultMinHeight = compareIgnoringAuto(extendHeight, resultMaxHeight, max); |
134 } | |
135 | |
136 // 4. Resolve initial width from min/max descriptors. | |
137 if (resultMinWidth != ViewportArguments::ValueAuto || resultMaxWidth != ViewportArguments::ValueAuto) | |
138 resultWidth = compareIgnoringAuto(resultMinWidth, compareIgnoringAut o(resultMaxWidth, initialViewportSize.width(), min), max); | |
139 | |
140 // 5. Resolve initial height from min/max descriptors. | |
141 if (resultMinHeight != ViewportArguments::ValueAuto || resultMaxHeight ! = ViewportArguments::ValueAuto) | |
142 resultHeight = compareIgnoringAuto(resultMinHeight, compareIgnoringA uto(resultMaxHeight, initialViewportSize.height(), min), max); | |
143 | |
144 // 6-7. Resolve width value. | |
145 if (resultWidth == ViewportArguments::ValueAuto) { | |
146 if (resultHeight == ViewportArguments::ValueAuto || !initialViewport Size .height()) | |
147 resultWidth = initialViewportSize.width(); | |
148 else | |
149 resultWidth = resultHeight * (initialViewportSize.width() / init ialViewportSize.height()); | |
150 } | |
151 | |
152 // 8. Resolve height value. | |
153 if (resultHeight == ViewportArguments::ValueAuto) { | |
154 if (!initialViewportSize.width()) | |
155 resultHeight = initialViewportSize.height(); | |
156 else | |
157 resultHeight = resultWidth * initialViewportSize.height() / init ialViewportSize.width(); | |
158 } | |
159 | |
160 PageScaleConstraints result; | |
161 result.minimumScale = resultMinZoom; | |
162 result.maximumScale = resultMaxZoom; | |
163 result.initialScale = resultZoom; | |
164 result.layoutSize.setWidth(resultWidth); | |
165 result.layoutSize.setHeight(resultHeight); | |
166 return result; | |
167 } | 127 } |
168 | 128 |
169 switch (static_cast<int>(resultWidth)) { | 129 // 4. Resolve initial width from min/max descriptors. |
170 case ViewportArguments::ValueDeviceWidth: | 130 if (resultMinWidth != ViewportArguments::ValueAuto || resultMaxWidth != View portArguments::ValueAuto) |
171 resultWidth = initialViewportSize.width(); | 131 resultWidth = compareIgnoringAuto(resultMinWidth, compareIgnoringAuto(re sultMaxWidth, initialViewportSize.width(), min), max); |
172 break; | 132 |
173 case ViewportArguments::ValueDeviceHeight: | 133 // 5. Resolve initial height from min/max descriptors. |
174 resultWidth = initialViewportSize.height(); | 134 if (resultMinHeight != ViewportArguments::ValueAuto || resultMaxHeight != Vi ewportArguments::ValueAuto) |
175 break; | 135 resultHeight = compareIgnoringAuto(resultMinHeight, compareIgnoringAuto( resultMaxHeight, initialViewportSize.height(), min), max); |
136 | |
137 // 6-7. Resolve width value. | |
138 if (resultWidth == ViewportArguments::ValueAuto) { | |
139 if (resultHeight == ViewportArguments::ValueAuto || !initialViewportSize .height()) | |
140 resultWidth = initialViewportSize.width(); | |
141 else | |
142 resultWidth = resultHeight * (initialViewportSize.width() / initialV iewportSize.height()); | |
176 } | 143 } |
177 | 144 |
178 switch (static_cast<int>(resultHeight)) { | 145 // 8. Resolve height value. |
179 case ViewportArguments::ValueDeviceWidth: | 146 if (resultHeight == ViewportArguments::ValueAuto) { |
180 resultHeight = initialViewportSize.width(); | 147 if (!initialViewportSize.width()) |
181 break; | 148 resultHeight = initialViewportSize.height(); |
182 case ViewportArguments::ValueDeviceHeight: | 149 else |
183 resultHeight = initialViewportSize.height(); | 150 resultHeight = resultWidth * initialViewportSize.height() / initialV iewportSize.width(); |
184 break; | |
185 } | 151 } |
186 | 152 |
187 if (type != ViewportArguments::Implicit) { | |
188 // Clamp values to a valid range, but not for @viewport since is | |
189 // not mandated by the specification. | |
190 resultWidth = clampLengthValue(resultWidth); | |
191 resultHeight = clampLengthValue(resultHeight); | |
192 resultZoom = clampScaleValue(resultZoom); | |
193 resultMinZoom = clampScaleValue(resultMinZoom); | |
194 resultMaxZoom = clampScaleValue(resultMaxZoom); | |
195 } | |
196 | |
197 PageScaleConstraints result; | |
198 | |
199 // Resolve minimum-scale and maximum-scale values according to spec. | |
200 if (resultMinZoom == ViewportArguments::ValueAuto) | |
201 result.minimumScale = float(0.25); | |
202 else | |
203 result.minimumScale = resultMinZoom; | |
204 | |
205 if (resultMaxZoom == ViewportArguments::ValueAuto) { | |
206 result.maximumScale = float(5.0); | |
207 result.minimumScale = min(float(5.0), result.minimumScale); | |
208 } else | |
209 result.maximumScale = resultMaxZoom; | |
210 result.maximumScale = max(result.minimumScale, result.maximumScale); | |
211 | |
212 // Resolve initial-scale value. | 153 // Resolve initial-scale value. |
213 result.initialScale = resultZoom; | |
214 if (resultZoom == ViewportArguments::ValueAuto) { | 154 if (resultZoom == ViewportArguments::ValueAuto) { |
215 result.initialScale = initialViewportSize.width() / defaultWidth; | |
216 if (resultWidth != ViewportArguments::ValueAuto && resultWidth > 0) | 155 if (resultWidth != ViewportArguments::ValueAuto && resultWidth > 0) |
217 result.initialScale = initialViewportSize.width() / resultWidth; | 156 resultZoom = initialViewportSize.width() / resultWidth; |
218 if (resultHeight != ViewportArguments::ValueAuto && resultHeight > 0) { | 157 if (resultHeight != ViewportArguments::ValueAuto && resultHeight > 0) { |
219 // if 'auto', the initial-scale will be negative here and thus ignor ed. | 158 // if 'auto', the initial-scale will be negative here and thus ignor ed. |
220 result.initialScale = max<float>(result.initialScale, initialViewpor tSize.height() / resultHeight); | 159 resultZoom = max<float>(resultZoom, initialViewportSize.height() / r esultHeight); |
221 } | 160 } |
222 } | 161 } |
223 | 162 |
224 // Constrain initial-scale value to minimum-scale/maximum-scale range. | |
225 result.initialScale = min(result.maximumScale, max(result.minimumScale, resu lt.initialScale)); | |
226 | |
227 // Resolve width value. | |
228 if (resultWidth == ViewportArguments::ValueAuto) { | |
229 if (resultZoom == ViewportArguments::ValueAuto) | |
230 resultWidth = defaultWidth; | |
231 else if (resultHeight != ViewportArguments::ValueAuto) | |
232 resultWidth = resultHeight * (initialViewportSize.width() / initialV iewportSize.height()); | |
233 else | |
234 resultWidth = initialViewportSize.width() / result.initialScale; | |
235 } | |
236 | |
237 // Resolve height value. | |
238 if (resultHeight == ViewportArguments::ValueAuto) | |
239 resultHeight = resultWidth * (initialViewportSize.height() / initialView portSize.width()); | |
240 | |
241 if (type == ViewportArguments::ViewportMeta) { | |
242 // Extend width and height to fill the visual viewport for the resolved initial-scale. | |
243 resultWidth = max<float>(resultWidth, initialViewportSize.width() / resu lt.initialScale); | |
244 resultHeight = max<float>(resultHeight, initialViewportSize.height() / r esult.initialScale); | |
245 } | |
246 | |
247 result.layoutSize.setWidth(resultWidth); | |
248 result.layoutSize.setHeight(resultHeight); | |
249 | |
250 // If user-scalable = no, lock the min/max scale to the computed initial | 163 // If user-scalable = no, lock the min/max scale to the computed initial |
251 // scale. | 164 // scale. |
252 if (!resultUserZoom) | 165 if (!resultUserZoom) |
253 result.maximumScale = result.minimumScale = result.initialScale; | 166 resultMinZoom = resultMaxZoom = resultZoom; |
254 | 167 |
255 // Only set initialScale to a value if it was explicitly set. | 168 // Only set initialScale to a value if it was explicitly set. |
256 if (resultZoom == ViewportArguments::ValueAuto) | 169 if (zoom == ViewportArguments::ValueAuto) |
257 result.initialScale = ViewportArguments::ValueAuto; | 170 resultZoom = ViewportArguments::ValueAuto; |
258 | 171 |
172 PageScaleConstraints result; | |
173 result.minimumScale = resultMinZoom; | |
174 result.maximumScale = resultMaxZoom; | |
175 result.initialScale = resultZoom; | |
176 result.layoutSize.setWidth(resultWidth); | |
177 result.layoutSize.setHeight(resultHeight); | |
259 return result; | 178 return result; |
260 } | 179 } |
261 | 180 |
262 static float numericPrefix(const String& keyString, const String& valueString, D ocument* document, bool* ok = 0) | 181 static float numericPrefix(const String& keyString, const String& valueString, D ocument* document, bool* ok = 0) |
263 { | 182 { |
264 size_t parsedLength; | 183 size_t parsedLength; |
265 float value; | 184 float value; |
266 if (valueString.is8Bit()) | 185 if (valueString.is8Bit()) |
267 value = charactersToFloat(valueString.characters8(), valueString.length( ), parsedLength); | 186 value = charactersToFloat(valueString.characters8(), valueString.length( ), parsedLength); |
268 else | 187 else |
(...skipping 21 matching lines...) Expand all Loading... | |
290 if (equalIgnoringCase(valueString, "device-width")) | 209 if (equalIgnoringCase(valueString, "device-width")) |
291 return ViewportArguments::ValueDeviceWidth; | 210 return ViewportArguments::ValueDeviceWidth; |
292 if (equalIgnoringCase(valueString, "device-height")) | 211 if (equalIgnoringCase(valueString, "device-height")) |
293 return ViewportArguments::ValueDeviceHeight; | 212 return ViewportArguments::ValueDeviceHeight; |
294 | 213 |
295 float value = numericPrefix(keyString, valueString, document); | 214 float value = numericPrefix(keyString, valueString, document); |
296 | 215 |
297 if (value < 0) | 216 if (value < 0) |
298 return ViewportArguments::ValueAuto; | 217 return ViewportArguments::ValueAuto; |
299 | 218 |
300 return value; | 219 return clampLengthValue(value); |
301 } | 220 } |
302 | 221 |
303 static float findScaleValue(const String& keyString, const String& valueString, Document* document) | 222 static float findScaleValue(const String& keyString, const String& valueString, Document* document) |
304 { | 223 { |
305 // 1) Non-negative number values are translated to <number> values. | 224 // 1) Non-negative number values are translated to <number> values. |
306 // 2) Negative number values are translated to auto. | 225 // 2) Negative number values are translated to auto. |
307 // 3) yes is translated to 1.0. | 226 // 3) yes is translated to 1.0. |
308 // 4) device-width and device-height are translated to 10.0. | 227 // 4) device-width and device-height are translated to 10.0. |
309 // 5) no and unknown values are translated to 0.0 | 228 // 5) no and unknown values are translated to 0.0 |
310 | 229 |
311 if (equalIgnoringCase(valueString, "yes")) | 230 if (equalIgnoringCase(valueString, "yes")) |
312 return 1; | 231 return 1; |
313 if (equalIgnoringCase(valueString, "no")) | 232 if (equalIgnoringCase(valueString, "no")) |
314 return 0; | 233 return 0; |
315 if (equalIgnoringCase(valueString, "device-width")) | 234 if (equalIgnoringCase(valueString, "device-width")) |
316 return 10; | 235 return 10; |
317 if (equalIgnoringCase(valueString, "device-height")) | 236 if (equalIgnoringCase(valueString, "device-height")) |
318 return 10; | 237 return 10; |
319 | 238 |
320 float value = numericPrefix(keyString, valueString, document); | 239 float value = numericPrefix(keyString, valueString, document); |
321 | 240 |
322 if (value < 0) | 241 if (value < 0) |
323 return ViewportArguments::ValueAuto; | 242 return ViewportArguments::ValueAuto; |
324 | 243 |
325 if (value > 10.0) | 244 if (value > 10.0) |
326 reportViewportWarning(document, MaximumScaleTooLargeError, String(), Str ing()); | 245 reportViewportWarning(document, MaximumScaleTooLargeError, String(), Str ing()); |
327 | 246 |
328 return value; | 247 return clampScaleValue(value); |
329 } | 248 } |
330 | 249 |
331 static float findUserScalableValue(const String& keyString, const String& valueS tring, Document* document) | 250 static float findUserScalableValue(const String& keyString, const String& valueS tring, Document* document) |
332 { | 251 { |
333 // yes and no are used as keywords. | 252 // yes and no are used as keywords. |
334 // Numbers >= 1, numbers <= -1, device-width and device-height are mapped to yes. | 253 // Numbers >= 1, numbers <= -1, device-width and device-height are mapped to yes. |
335 // Numbers in the range <-1, 1>, and unknown values, are mapped to no. | 254 // Numbers in the range <-1, 1>, and unknown values, are mapped to no. |
336 | 255 |
337 if (equalIgnoringCase(valueString, "yes")) | 256 if (equalIgnoringCase(valueString, "yes")) |
338 return 1; | 257 return 1; |
(...skipping 28 matching lines...) Expand all Loading... | |
367 if (!ok || value < 70 || value > 400) | 286 if (!ok || value < 70 || value > 400) |
368 return ViewportArguments::ValueAuto; | 287 return ViewportArguments::ValueAuto; |
369 | 288 |
370 return value; | 289 return value; |
371 } | 290 } |
372 | 291 |
373 void setViewportFeature(const String& keyString, const String& valueString, Docu ment* document, void* data) | 292 void setViewportFeature(const String& keyString, const String& valueString, Docu ment* document, void* data) |
374 { | 293 { |
375 ViewportArguments* arguments = static_cast<ViewportArguments*>(data); | 294 ViewportArguments* arguments = static_cast<ViewportArguments*>(data); |
376 | 295 |
377 if (keyString == "width") | 296 if (keyString == "width") { |
378 arguments->width = findSizeValue(keyString, valueString, document); | 297 float width = findSizeValue(keyString, valueString, document); |
379 else if (keyString == "height") | 298 if (width != ViewportArguments::ValueAuto) { |
380 arguments->height = findSizeValue(keyString, valueString, document); | 299 arguments->minWidth = ViewportArguments::ValueExtendToZoom; |
381 else if (keyString == "initial-scale") | 300 arguments->maxWidth = width; |
301 } | |
302 } else if (keyString == "height") { | |
303 float height = findSizeValue(keyString, valueString, document); | |
304 if (height != ViewportArguments::ValueAuto) { | |
305 arguments->minHeight = ViewportArguments::ValueExtendToZoom; | |
306 arguments->maxHeight = height; | |
307 } | |
308 } else if (keyString == "initial-scale") { | |
382 arguments->zoom = findScaleValue(keyString, valueString, document); | 309 arguments->zoom = findScaleValue(keyString, valueString, document); |
383 else if (keyString == "minimum-scale") | 310 } else if (keyString == "minimum-scale") { |
384 arguments->minZoom = findScaleValue(keyString, valueString, document); | 311 arguments->minZoom = findScaleValue(keyString, valueString, document); |
385 else if (keyString == "maximum-scale") | 312 } else if (keyString == "maximum-scale") { |
386 arguments->maxZoom = findScaleValue(keyString, valueString, document); | 313 arguments->maxZoom = findScaleValue(keyString, valueString, document); |
387 else if (keyString == "user-scalable") | 314 } else if (keyString == "user-scalable") { |
388 arguments->userZoom = findUserScalableValue(keyString, valueString, docu ment); | 315 arguments->userZoom = findUserScalableValue(keyString, valueString, docu ment); |
389 else if (keyString == "target-densitydpi") { | 316 } else if (keyString == "target-densitydpi") { |
390 arguments->deprecatedTargetDensityDPI = findTargetDensityDPIValue(keyStr ing, valueString, document); | 317 arguments->deprecatedTargetDensityDPI = findTargetDensityDPIValue(keyStr ing, valueString, document); |
391 reportViewportWarning(document, TargetDensityDpiUnsupported, String(), S tring()); | 318 reportViewportWarning(document, TargetDensityDpiUnsupported, String(), S tring()); |
392 } else | 319 } else { |
393 reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, ke yString, String()); | 320 reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, ke yString, String()); |
321 } | |
394 } | 322 } |
395 | 323 |
396 static const char* viewportErrorMessageTemplate(ViewportErrorCode errorCode) | 324 static const char* viewportErrorMessageTemplate(ViewportErrorCode errorCode) |
397 { | 325 { |
398 static const char* const errors[] = { | 326 static const char* const errors[] = { |
399 "Note that ';' is not a key-value pair separator. The list should be com ma-separated.", | 327 "Note that ';' is not a key-value pair separator. The list should be com ma-separated.", |
400 "The key \"%replacement1\" is not recognized and ignored.", | 328 "The key \"%replacement1\" is not recognized and ignored.", |
401 "The value \"%replacement1\" for key \"%replacement2\" is invalid, and h as been ignored.", | 329 "The value \"%replacement1\" for key \"%replacement2\" is invalid, and h as been ignored.", |
402 "The value \"%replacement1\" for key \"%replacement2\" was truncated to its numeric prefix.", | 330 "The value \"%replacement1\" for key \"%replacement2\" was truncated to its numeric prefix.", |
403 "The value for key \"maximum-scale\" is out of bounds and the value has been clamped.", | 331 "The value for key \"maximum-scale\" is out of bounds and the value has been clamped.", |
(...skipping 30 matching lines...) Expand all Loading... | |
434 if (!replacement1.isNull()) | 362 if (!replacement1.isNull()) |
435 message.replace("%replacement1", replacement1); | 363 message.replace("%replacement1", replacement1); |
436 if (!replacement2.isNull()) | 364 if (!replacement2.isNull()) |
437 message.replace("%replacement2", replacement2); | 365 message.replace("%replacement2", replacement2); |
438 | 366 |
439 // FIXME: This message should be moved off the console once a solution to ht tps://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 367 // FIXME: This message should be moved off the console once a solution to ht tps://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
440 document->addConsoleMessage(RenderingMessageSource, viewportErrorMessageLeve l(errorCode), message); | 368 document->addConsoleMessage(RenderingMessageSource, viewportErrorMessageLeve l(errorCode), message); |
441 } | 369 } |
442 | 370 |
443 } // namespace WebCore | 371 } // namespace WebCore |
OLD | NEW |