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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 return i; | 59 return i; |
60 } | 60 } |
61 | 61 |
62 template<typename CharType> | 62 template<typename CharType> |
63 static Length parseHTMLAreaCoordinate(const CharType* data, unsigned length) | 63 static Length parseHTMLAreaCoordinate(const CharType* data, unsigned length) |
64 { | 64 { |
65 unsigned intLength; | 65 unsigned intLength; |
66 unsigned doubleLength; | 66 unsigned doubleLength; |
67 splitLength(data, length, intLength, doubleLength); | 67 splitLength(data, length, intLength, doubleLength); |
68 | 68 |
69 bool ok; | 69 return Length(charactersToIntStrict(data, intLength), Fixed); |
70 int r = charactersToIntStrict(data, intLength, &ok); | |
71 if (ok) | |
72 return Length(r, Fixed); | |
73 return Length(0, Fixed); | |
74 } | 70 } |
75 | 71 |
76 // FIXME: Per HTML5, this should follow the "rules for parsing a list of integer
s". | 72 // FIXME: Per HTML5, this should follow the "rules for parsing a list of integer
s". |
77 Vector<Length> parseHTMLAreaElementCoords(const String& string) | 73 Vector<Length> parseHTMLAreaElementCoords(const String& string) |
78 { | 74 { |
79 unsigned length = string.length(); | 75 unsigned length = string.length(); |
80 StringBuffer<LChar> spacified(length); | 76 StringBuffer<LChar> spacified(length); |
81 for (unsigned i = 0; i < length; i++) { | 77 for (unsigned i = 0; i < length; i++) { |
82 UChar cc = string[i]; | 78 UChar cc = string[i]; |
83 if (cc > '9' || (cc < '0' && cc != '-' && cc != '.')) | 79 if (cc > '9' || (cc < '0' && cc != '-' && cc != '.')) |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 return isCalculated() && (&calculationValue() == &o.calculationValue() || ca
lculationValue() == o.calculationValue()); | 242 return isCalculated() && (&calculationValue() == &o.calculationValue() || ca
lculationValue() == o.calculationValue()); |
247 } | 243 } |
248 | 244 |
249 struct SameSizeAsLength { | 245 struct SameSizeAsLength { |
250 int32_t value; | 246 int32_t value; |
251 int32_t metaData; | 247 int32_t metaData; |
252 }; | 248 }; |
253 static_assert(sizeof(Length) == sizeof(SameSizeAsLength), "length should stay sm
all"); | 249 static_assert(sizeof(Length) == sizeof(SameSizeAsLength), "length should stay sm
all"); |
254 | 250 |
255 } // namespace blink | 251 } // namespace blink |
OLD | NEW |