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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 322 |
323 while (position < end) { | 323 while (position < end) { |
324 skipWhile<CharacterType, isNotSpaceDelimiterOrNumberStart>(position, end); | 324 skipWhile<CharacterType, isNotSpaceDelimiterOrNumberStart>(position, end); |
325 | 325 |
326 const CharacterType* unparsedNumberStart = position; | 326 const CharacterType* unparsedNumberStart = position; |
327 skipUntil<CharacterType, isSpaceOrDelimiter>(position, end); | 327 skipUntil<CharacterType, isSpaceOrDelimiter>(position, end); |
328 | 328 |
329 size_t parsedLength = 0; | 329 size_t parsedLength = 0; |
330 double number = charactersToDouble( | 330 double number = charactersToDouble( |
331 unparsedNumberStart, position - unparsedNumberStart, parsedLength); | 331 unparsedNumberStart, position - unparsedNumberStart, parsedLength); |
332 numbers.append(checkDoubleValue(number, parsedLength != 0, 0)); | 332 numbers.push_back(checkDoubleValue(number, parsedLength != 0, 0)); |
333 | 333 |
334 skipWhile<CharacterType, isSpaceOrDelimiter>(position, end); | 334 skipWhile<CharacterType, isSpaceOrDelimiter>(position, end); |
335 } | 335 } |
336 return numbers; | 336 return numbers; |
337 } | 337 } |
338 | 338 |
339 // https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-
a-list-of-floating-point-numbers | 339 // https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-
a-list-of-floating-point-numbers |
340 Vector<double> parseHTMLListOfFloatingPointNumbers(const String& input) { | 340 Vector<double> parseHTMLListOfFloatingPointNumbers(const String& input) { |
341 unsigned length = input.length(); | 341 unsigned length = input.length(); |
342 if (!length || input.is8Bit()) | 342 if (!length || input.is8Bit()) |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 string = StringImpl::create8BitIfPossible(characters, size); | 491 string = StringImpl::create8BitIfPossible(characters, size); |
492 else if (width == Force8Bit) | 492 else if (width == Force8Bit) |
493 string = String::make8BitFrom16BitSource(characters, size); | 493 string = String::make8BitFrom16BitSource(characters, size); |
494 else | 494 else |
495 string = String(characters, size); | 495 string = String(characters, size); |
496 | 496 |
497 return string; | 497 return string; |
498 } | 498 } |
499 | 499 |
500 } // namespace blink | 500 } // namespace blink |
OLD | NEW |