OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 inline void CSSTokenizer::parseIdentifier(CharacterType*& result, CSSParserStrin
g& resultString, bool& hasEscape) | 485 inline void CSSTokenizer::parseIdentifier(CharacterType*& result, CSSParserStrin
g& resultString, bool& hasEscape) |
486 { | 486 { |
487 // If a valid identifier start is found, we can safely | 487 // If a valid identifier start is found, we can safely |
488 // parse the identifier until the next invalid character. | 488 // parse the identifier until the next invalid character. |
489 ASSERT(isIdentifierStart<CharacterType>()); | 489 ASSERT(isIdentifierStart<CharacterType>()); |
490 | 490 |
491 CharacterType* start = currentCharacter<CharacterType>(); | 491 CharacterType* start = currentCharacter<CharacterType>(); |
492 if (UNLIKELY(!parseIdentifierInternal(currentCharacter<CharacterType>(), res
ult, hasEscape))) { | 492 if (UNLIKELY(!parseIdentifierInternal(currentCharacter<CharacterType>(), res
ult, hasEscape))) { |
493 // Found an escape we couldn't handle with 8 bits, copy what has been re
cognized and continue | 493 // Found an escape we couldn't handle with 8 bits, copy what has been re
cognized and continue |
494 ASSERT(is8BitSource()); | 494 ASSERT(is8BitSource()); |
495 UChar* result16 = allocateStringBuffer16((result - start) + peekMaxIdent
ifierLen(result)); | 495 UChar* result16 = allocateStringBuffer16((result - start) + peekMaxIdent
ifierLen(currentCharacter<CharacterType>())); |
496 UChar* start16 = result16; | 496 UChar* start16 = result16; |
497 int i = 0; | 497 int i = 0; |
498 for (; i < result - start; i++) | 498 for (; i < result - start; i++) |
499 result16[i] = start[i]; | 499 result16[i] = start[i]; |
500 | 500 |
501 result16 += i; | 501 result16 += i; |
502 | 502 |
503 parseIdentifierInternal(currentCharacter<CharacterType>(), result16, has
Escape); | 503 parseIdentifierInternal(currentCharacter<CharacterType>(), result16, has
Escape); |
504 | 504 |
505 resultString.init(start16, result16 - start16); | 505 resultString.init(start16, result16 - start16); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 } | 558 } |
559 | 559 |
560 template <typename CharacterType> | 560 template <typename CharacterType> |
561 inline void CSSTokenizer::parseString(CharacterType*& result, CSSParserString& r
esultString, UChar quote) | 561 inline void CSSTokenizer::parseString(CharacterType*& result, CSSParserString& r
esultString, UChar quote) |
562 { | 562 { |
563 CharacterType* start = currentCharacter<CharacterType>(); | 563 CharacterType* start = currentCharacter<CharacterType>(); |
564 | 564 |
565 if (UNLIKELY(!parseStringInternal(currentCharacter<CharacterType>(), result,
quote))) { | 565 if (UNLIKELY(!parseStringInternal(currentCharacter<CharacterType>(), result,
quote))) { |
566 // Found an escape we couldn't handle with 8 bits, copy what has been re
cognized and continue | 566 // Found an escape we couldn't handle with 8 bits, copy what has been re
cognized and continue |
567 ASSERT(is8BitSource()); | 567 ASSERT(is8BitSource()); |
568 UChar* result16 = allocateStringBuffer16((result - start) + peekMaxStrin
gLen(result, quote)); | 568 UChar* result16 = allocateStringBuffer16((result - start) + peekMaxStrin
gLen(currentCharacter<CharacterType>(), quote)); |
569 UChar* start16 = result16; | 569 UChar* start16 = result16; |
570 int i = 0; | 570 int i = 0; |
571 for (; i < result - start; i++) | 571 for (; i < result - start; i++) |
572 result16[i] = start[i]; | 572 result16[i] = start[i]; |
573 | 573 |
574 result16 += i; | 574 result16 += i; |
575 | 575 |
576 parseStringInternal(currentCharacter<CharacterType>(), result16, quote); | 576 parseStringInternal(currentCharacter<CharacterType>(), result16, quote); |
577 | 577 |
578 resultString.init(start16, result16 - start16); | 578 resultString.init(start16, result16 - start16); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 return; | 668 return; |
669 | 669 |
670 CharacterType* dest = currentCharacter<CharacterType>() = uriStart; | 670 CharacterType* dest = currentCharacter<CharacterType>() = uriStart; |
671 if (LIKELY(parseURIInternal(currentCharacter<CharacterType>(), dest, quote))
) { | 671 if (LIKELY(parseURIInternal(currentCharacter<CharacterType>(), dest, quote))
) { |
672 string.init(uriStart, dest - uriStart); | 672 string.init(uriStart, dest - uriStart); |
673 } else { | 673 } else { |
674 // An escape sequence was encountered that can't be stored in 8 bits. | 674 // An escape sequence was encountered that can't be stored in 8 bits. |
675 // Reset the current character to the start of the URI and re-parse with | 675 // Reset the current character to the start of the URI and re-parse with |
676 // a 16-bit destination. | 676 // a 16-bit destination. |
677 ASSERT(is8BitSource()); | 677 ASSERT(is8BitSource()); |
678 UChar* result16 = allocateStringBuffer16(peekMaxURILen(uriStart, quote))
; | 678 currentCharacter<CharacterType>() = uriStart; |
| 679 UChar* result16 = allocateStringBuffer16(peekMaxURILen(currentCharacter<
CharacterType>(), quote)); |
679 UChar* uriStart16 = result16; | 680 UChar* uriStart16 = result16; |
680 currentCharacter<CharacterType>() = uriStart; | |
681 bool result = parseURIInternal(currentCharacter<CharacterType>(), result
16, quote); | 681 bool result = parseURIInternal(currentCharacter<CharacterType>(), result
16, quote); |
682 ASSERT_UNUSED(result, result); | 682 ASSERT_UNUSED(result, result); |
683 string.init(uriStart16, result16 - uriStart16); | 683 string.init(uriStart16, result16 - uriStart16); |
684 } | 684 } |
685 | 685 |
686 currentCharacter<CharacterType>() = uriEnd + 1; | 686 currentCharacter<CharacterType>() = uriEnd + 1; |
687 m_token = URI; | 687 m_token = URI; |
688 } | 688 } |
689 | 689 |
690 template <typename CharacterType> | 690 template <typename CharacterType> |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 m_dataStart16[length - 1] = 0; | 1580 m_dataStart16[length - 1] = 0; |
1581 | 1581 |
1582 m_is8BitSource = false; | 1582 m_is8BitSource = false; |
1583 m_currentCharacter8 = 0; | 1583 m_currentCharacter8 = 0; |
1584 m_currentCharacter16 = m_dataStart16.get(); | 1584 m_currentCharacter16 = m_dataStart16.get(); |
1585 setTokenStart<UChar>(m_currentCharacter16); | 1585 setTokenStart<UChar>(m_currentCharacter16); |
1586 m_lexFunc = &CSSTokenizer::realLex<UChar>; | 1586 m_lexFunc = &CSSTokenizer::realLex<UChar>; |
1587 } | 1587 } |
1588 | 1588 |
1589 } // namespace WebCore | 1589 } // namespace WebCore |
OLD | NEW |