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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 if (equalIgnoringCase(valueString, "device-width")) | 228 if (equalIgnoringCase(valueString, "device-width")) |
229 return Length(100, ViewportPercentageWidth); | 229 return Length(100, ViewportPercentageWidth); |
230 if (equalIgnoringCase(valueString, "device-height")) | 230 if (equalIgnoringCase(valueString, "device-height")) |
231 return Length(100, ViewportPercentageHeight); | 231 return Length(100, ViewportPercentageHeight); |
232 | 232 |
233 float value = numericPrefix(keyString, valueString, document); | 233 float value = numericPrefix(keyString, valueString, document); |
234 | 234 |
235 if (value < 0) | 235 if (value < 0) |
236 return Length(); // auto | 236 return Length(); // auto |
237 | 237 |
238 if (!static_cast<int>(value) && document->page() && document->page()->settin
gs().viewportMetaZeroValuesQuirk()) { | 238 if (!value && document->page() && document->page()->settings().viewportMetaZ
eroValuesQuirk()) { |
239 if (keyString == "width") | 239 if (keyString == "width") |
240 return Length(100, ViewportPercentageWidth); | 240 return Length(100, ViewportPercentageWidth); |
241 if (keyString == "height") | 241 if (keyString == "height") |
242 return Length(100, ViewportPercentageHeight); | 242 return Length(100, ViewportPercentageHeight); |
243 } | 243 } |
244 | 244 |
245 return Length(clampLengthValue(value), Fixed); | 245 return Length(clampLengthValue(value), Fixed); |
246 } | 246 } |
247 | 247 |
248 static float findScaleValue(const String& keyString, const String& valueString,
Document* document) | 248 static float findScaleValue(const String& keyString, const String& valueString,
Document* document) |
(...skipping 14 matching lines...) Expand all Loading... |
263 return 10; | 263 return 10; |
264 | 264 |
265 float value = numericPrefix(keyString, valueString, document); | 265 float value = numericPrefix(keyString, valueString, document); |
266 | 266 |
267 if (value < 0) | 267 if (value < 0) |
268 return ViewportArguments::ValueAuto; | 268 return ViewportArguments::ValueAuto; |
269 | 269 |
270 if (value > 10.0) | 270 if (value > 10.0) |
271 reportViewportWarning(document, MaximumScaleTooLargeError, String(), Str
ing()); | 271 reportViewportWarning(document, MaximumScaleTooLargeError, String(), Str
ing()); |
272 | 272 |
273 if (!static_cast<int>(value) && document->page() && document->page()->settin
gs().viewportMetaZeroValuesQuirk() && (keyString == "minimum-scale" || keyString
== "maximum-scale")) | 273 if (!value && document->page() && document->page()->settings().viewportMetaZ
eroValuesQuirk() && (keyString == "minimum-scale" || keyString == "maximum-scale
")) |
274 return ViewportArguments::ValueAuto; | 274 return ViewportArguments::ValueAuto; |
275 | 275 |
276 return clampScaleValue(value); | 276 return clampScaleValue(value); |
277 } | 277 } |
278 | 278 |
279 static float findUserScalableValue(const String& keyString, const String& valueS
tring, Document* document) | 279 static float findUserScalableValue(const String& keyString, const String& valueS
tring, Document* document) |
280 { | 280 { |
281 // yes and no are used as keywords. | 281 // yes and no are used as keywords. |
282 // Numbers >= 1, numbers <= -1, device-width and device-height are mapped to
yes. | 282 // Numbers >= 1, numbers <= -1, device-width and device-height are mapped to
yes. |
283 // Numbers in the range <-1, 1>, and unknown values, are mapped to no. | 283 // Numbers in the range <-1, 1>, and unknown values, are mapped to no. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 if (!replacement1.isNull()) | 389 if (!replacement1.isNull()) |
390 message.replace("%replacement1", replacement1); | 390 message.replace("%replacement1", replacement1); |
391 if (!replacement2.isNull()) | 391 if (!replacement2.isNull()) |
392 message.replace("%replacement2", replacement2); | 392 message.replace("%replacement2", replacement2); |
393 | 393 |
394 // FIXME: This message should be moved off the console once a solution to ht
tps://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 394 // FIXME: This message should be moved off the console once a solution to ht
tps://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
395 document->addConsoleMessage(RenderingMessageSource, viewportErrorMessageLeve
l(errorCode), message); | 395 document->addConsoleMessage(RenderingMessageSource, viewportErrorMessageLeve
l(errorCode), message); |
396 } | 396 } |
397 | 397 |
398 } // namespace WebCore | 398 } // namespace WebCore |
OLD | NEW |