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 10663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10674 ++current; | 10674 ++current; |
10675 } while (current < result); | 10675 } while (current < result); |
10676 } | 10676 } |
10677 } | 10677 } |
10678 break; | 10678 break; |
10679 } | 10679 } |
10680 | 10680 |
10681 case CharacterSlash: | 10681 case CharacterSlash: |
10682 // Ignore comments. They are not even considered as white spaces. | 10682 // Ignore comments. They are not even considered as white spaces. |
10683 if (*currentCharacter<SrcCharacterType>() == '*') { | 10683 if (*currentCharacter<SrcCharacterType>() == '*') { |
| 10684 const CSSParserLocation startLocation = currentLocation(); |
10684 if (m_sourceDataHandler) { | 10685 if (m_sourceDataHandler) { |
10685 unsigned startOffset = (is8BitSource() ? currentCharacter<LChar>
() - m_dataStart8.get() : currentCharacter<UChar>() - m_dataStart16.get()) - 1;
// Start with a slash. | 10686 unsigned startOffset = (is8BitSource() ? currentCharacter<LChar>
() - m_dataStart8.get() : currentCharacter<UChar>() - m_dataStart16.get()) - 1;
// Start with a slash. |
10686 m_sourceDataHandler->startComment(startOffset - m_parsedTextPref
ixLength); | 10687 m_sourceDataHandler->startComment(startOffset - m_parsedTextPref
ixLength); |
10687 } | 10688 } |
10688 ++currentCharacter<SrcCharacterType>(); | 10689 ++currentCharacter<SrcCharacterType>(); |
10689 while (currentCharacter<SrcCharacterType>()[0] != '*' || currentChar
acter<SrcCharacterType>()[1] != '/') { | 10690 while (currentCharacter<SrcCharacterType>()[0] != '*' || currentChar
acter<SrcCharacterType>()[1] != '/') { |
10690 if (*currentCharacter<SrcCharacterType>() == '\n') | 10691 if (*currentCharacter<SrcCharacterType>() == '\n') |
10691 ++m_lineNumber; | 10692 ++m_lineNumber; |
10692 if (*currentCharacter<SrcCharacterType>() == '\0') { | 10693 if (*currentCharacter<SrcCharacterType>() == '\0') { |
10693 // Unterminated comments are simply ignored. | 10694 // Unterminated comments are simply ignored. |
10694 currentCharacter<SrcCharacterType>() -= 2; | 10695 currentCharacter<SrcCharacterType>() -= 2; |
| 10696 reportError(startLocation, UnterminatedCommentError); |
10695 break; | 10697 break; |
10696 } | 10698 } |
10697 ++currentCharacter<SrcCharacterType>(); | 10699 ++currentCharacter<SrcCharacterType>(); |
10698 } | 10700 } |
10699 currentCharacter<SrcCharacterType>() += 2; | 10701 currentCharacter<SrcCharacterType>() += 2; |
10700 if (m_sourceDataHandler) { | 10702 if (m_sourceDataHandler) { |
10701 unsigned endOffset = is8BitSource() ? currentCharacter<LChar>()
- m_dataStart8.get() : currentCharacter<UChar>() - m_dataStart16.get(); | 10703 unsigned endOffset = is8BitSource() ? currentCharacter<LChar>()
- m_dataStart8.get() : currentCharacter<UChar>() - m_dataStart16.get(); |
10702 unsigned userTextEndOffset = static_cast<unsigned>(m_length - 1
- m_parsedTextSuffixLength); | 10704 unsigned userTextEndOffset = static_cast<unsigned>(m_length - 1
- m_parsedTextSuffixLength); |
10703 m_sourceDataHandler->endComment(min(endOffset, userTextEndOffset
) - m_parsedTextPrefixLength); | 10705 m_sourceDataHandler->endComment(min(endOffset, userTextEndOffset
) - m_parsedTextPrefixLength); |
10704 } | 10706 } |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11132 break; | 11134 break; |
11133 | 11135 |
11134 case InvalidSelectorPseudoError: | 11136 case InvalidSelectorPseudoError: |
11135 builder.appendLiteral("Invalid CSS selector pseudoclass: "); | 11137 builder.appendLiteral("Invalid CSS selector pseudoclass: "); |
11136 break; | 11138 break; |
11137 | 11139 |
11138 case InvalidKeyframeSelectorError: | 11140 case InvalidKeyframeSelectorError: |
11139 builder.appendLiteral("Invalid CSS keyframe selector: "); | 11141 builder.appendLiteral("Invalid CSS keyframe selector: "); |
11140 break; | 11142 break; |
11141 | 11143 |
| 11144 case UnterminatedCommentError: |
| 11145 content.setLength(0); |
| 11146 builder.appendLiteral("Unterminated CSS comment"); |
| 11147 break; |
| 11148 |
11142 default: | 11149 default: |
11143 builder.appendLiteral("Unexpected CSS token: "); | 11150 builder.appendLiteral("Unexpected CSS token: "); |
11144 } | 11151 } |
11145 | 11152 |
11146 builder.append(content); | 11153 builder.append(content); |
11147 | 11154 |
11148 logError(builder.toString(), location.lineNumber); | 11155 logError(builder.toString(), location.lineNumber); |
11149 } | 11156 } |
11150 | 11157 |
11151 bool CSSParser::isLoggingErrors() | 11158 bool CSSParser::isLoggingErrors() |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11871 { | 11878 { |
11872 // The tokenizer checks for the construct of an+b. | 11879 // The tokenizer checks for the construct of an+b. |
11873 // However, since the {ident} rule precedes the {nth} rule, some of those | 11880 // However, since the {ident} rule precedes the {nth} rule, some of those |
11874 // tokens are identified as string literal. Furthermore we need to accept | 11881 // tokens are identified as string literal. Furthermore we need to accept |
11875 // "odd" and "even" which does not match to an+b. | 11882 // "odd" and "even" which does not match to an+b. |
11876 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11883 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
11877 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11884 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
11878 } | 11885 } |
11879 | 11886 |
11880 } | 11887 } |
OLD | NEW |