OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 numbers.append(checkDoubleValue(number, parsedLength != 0, 0)); | 302 numbers.append(checkDoubleValue(number, parsedLength != 0, 0)); |
303 | 303 |
304 skipWhile<CharacterType, isSpaceOrDelimiter>(position, end); | 304 skipWhile<CharacterType, isSpaceOrDelimiter>(position, end); |
305 } | 305 } |
306 return numbers; | 306 return numbers; |
307 } | 307 } |
308 | 308 |
309 // https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-
a-list-of-floating-point-numbers | 309 // https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-
a-list-of-floating-point-numbers |
310 Vector<double> parseHTMLListOfFloatingPointNumbers(const String& input) | 310 Vector<double> parseHTMLListOfFloatingPointNumbers(const String& input) |
311 { | 311 { |
312 if (input.is8Bit()) | 312 unsigned length = input.length(); |
313 return parseHTMLListOfFloatingPointNumbersInternal(input.characters8(),
input.characters8() + input.length()); | 313 if (!length || input.is8Bit()) |
314 return parseHTMLListOfFloatingPointNumbersInternal(input.characters16(), inp
ut.characters16() + input.length()); | 314 return parseHTMLListOfFloatingPointNumbersInternal(input.characters8(),
input.characters8() + length); |
| 315 return parseHTMLListOfFloatingPointNumbersInternal(input.characters16(), inp
ut.characters16() + length); |
315 } | 316 } |
316 | 317 |
317 static const char charsetString[] = "charset"; | 318 static const char charsetString[] = "charset"; |
318 static const size_t charsetLength = sizeof("charset") - 1; | 319 static const size_t charsetLength = sizeof("charset") - 1; |
319 | 320 |
320 String extractCharset(const String& value) | 321 String extractCharset(const String& value) |
321 { | 322 { |
322 size_t pos = 0; | 323 size_t pos = 0; |
323 unsigned length = value.length(); | 324 unsigned length = value.length(); |
324 | 325 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 string = StringImpl::create8BitIfPossible(characters, size); | 460 string = StringImpl::create8BitIfPossible(characters, size); |
460 else if (width == Force8Bit) | 461 else if (width == Force8Bit) |
461 string = String::make8BitFrom16BitSource(characters, size); | 462 string = String::make8BitFrom16BitSource(characters, size); |
462 else | 463 else |
463 string = String(characters, size); | 464 string = String(characters, size); |
464 | 465 |
465 return string; | 466 return string; |
466 } | 467 } |
467 | 468 |
468 } // namespace blink | 469 } // namespace blink |
OLD | NEW |