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 10289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10300 if (isASCIIAlphaCaselessEqual(name[0], 'o') && isASCIIAlphaCaselessEqual (name[1], 'r')) | 10300 if (isASCIIAlphaCaselessEqual(name[0], 'o') && isASCIIAlphaCaselessEqual (name[1], 'r')) |
10301 m_token = SUPPORTS_OR; | 10301 m_token = SUPPORTS_OR; |
10302 } else if (length == 3) { | 10302 } else if (length == 3) { |
10303 if (isASCIIAlphaCaselessEqual(name[0], 'a') && isASCIIAlphaCaselessEqual (name[1], 'n') && isASCIIAlphaCaselessEqual(name[2], 'd')) | 10303 if (isASCIIAlphaCaselessEqual(name[0], 'a') && isASCIIAlphaCaselessEqual (name[1], 'n') && isASCIIAlphaCaselessEqual(name[2], 'd')) |
10304 m_token = SUPPORTS_AND; | 10304 m_token = SUPPORTS_AND; |
10305 else if (isASCIIAlphaCaselessEqual(name[0], 'n') && isASCIIAlphaCaseless Equal(name[1], 'o') && isASCIIAlphaCaselessEqual(name[2], 't')) | 10305 else if (isASCIIAlphaCaselessEqual(name[0], 'n') && isASCIIAlphaCaseless Equal(name[1], 'o') && isASCIIAlphaCaselessEqual(name[2], 't')) |
10306 m_token = SUPPORTS_NOT; | 10306 m_token = SUPPORTS_NOT; |
10307 } | 10307 } |
10308 } | 10308 } |
10309 | 10309 |
10310 template <typename CharacterType> | |
10311 inline bool CSSParser::detectCSSVariablesToken(int length) | |
10312 { | |
10313 if (length >= 12) { | |
eseidel
2013/05/21 01:33:11
Why 12? webkit-var is 10 chars, no? Can this by
alancutter (OOO until 2018)
2013/05/21 03:56:05
We are trying to match on "-webkit-var-" as prefix
| |
10314 CharacterType* name = tokenStart<CharacterType>(); | |
10315 if (name[11] == '-' && isEqualToCSSIdentifier(name + 1, "webkit-var")) | |
10316 return true; | |
10317 } | |
10318 return false; | |
10319 } | |
10320 | |
10321 | |
10310 template <typename SrcCharacterType> | 10322 template <typename SrcCharacterType> |
10311 int CSSParser::realLex(void* yylvalWithoutType) | 10323 int CSSParser::realLex(void* yylvalWithoutType) |
10312 { | 10324 { |
10313 YYSTYPE* yylval = static_cast<YYSTYPE*>(yylvalWithoutType); | 10325 YYSTYPE* yylval = static_cast<YYSTYPE*>(yylvalWithoutType); |
10314 // Write pointer for the next character. | 10326 // Write pointer for the next character. |
10315 SrcCharacterType* result; | 10327 SrcCharacterType* result; |
10316 CSSParserString resultString; | 10328 CSSParserString resultString; |
10317 bool hasEscape; | 10329 bool hasEscape; |
10318 | 10330 |
10319 // The input buffer is terminated by a \0 character, so | 10331 // The input buffer is terminated by a \0 character, so |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10484 m_token = dotSeen ? FLOATTOKEN : INTEGER; | 10496 m_token = dotSeen ? FLOATTOKEN : INTEGER; |
10485 break; | 10497 break; |
10486 } | 10498 } |
10487 | 10499 |
10488 case CharacterDash: | 10500 case CharacterDash: |
10489 if (isIdentifierStartAfterDash(currentCharacter<SrcCharacterType>())) { | 10501 if (isIdentifierStartAfterDash(currentCharacter<SrcCharacterType>())) { |
10490 --currentCharacter<SrcCharacterType>(); | 10502 --currentCharacter<SrcCharacterType>(); |
10491 parseIdentifier(result, resultString, hasEscape); | 10503 parseIdentifier(result, resultString, hasEscape); |
10492 m_token = IDENT; | 10504 m_token = IDENT; |
10493 | 10505 |
10494 if (cssVariablesEnabled() && isEqualToCSSIdentifier(tokenStart<SrcCh aracterType>() + 1, "webkit-var") && tokenStart<SrcCharacterType>()[11] == '-' & & isIdentifierStartAfterDash(tokenStart<SrcCharacterType>() + 12)) | 10506 if (cssVariablesEnabled() && detectCSSVariablesToken<SrcCharacterTyp e>(result - tokenStart<SrcCharacterType>())) |
10495 m_token = VAR_DEFINITION; | 10507 m_token = VAR_DEFINITION; |
10496 else if (*currentCharacter<SrcCharacterType>() == '(') { | 10508 else if (*currentCharacter<SrcCharacterType>() == '(') { |
10497 m_token = FUNCTION; | 10509 m_token = FUNCTION; |
10498 if (!hasEscape) | 10510 if (!hasEscape) |
10499 detectDashToken<SrcCharacterType>(result - tokenStart<SrcCha racterType>()); | 10511 detectDashToken<SrcCharacterType>(result - tokenStart<SrcCha racterType>()); |
10500 ++currentCharacter<SrcCharacterType>(); | 10512 ++currentCharacter<SrcCharacterType>(); |
10501 ++result; | 10513 ++result; |
10502 } else if (UNLIKELY(m_parsingMode == NthChildMode) && !hasEscape && isASCIIAlphaCaselessEqual(tokenStart<SrcCharacterType>()[1], 'n')) { | 10514 } else if (UNLIKELY(m_parsingMode == NthChildMode) && !hasEscape && isASCIIAlphaCaselessEqual(tokenStart<SrcCharacterType>()[1], 'n')) { |
10503 if (result - tokenStart<SrcCharacterType>() == 2) { | 10515 if (result - tokenStart<SrcCharacterType>() == 2) { |
10504 // String "-n" is IDENT but "-n+1" is NTH. | 10516 // String "-n" is IDENT but "-n+1" is NTH. |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11730 result.lineNumber = lineNumber; | 11742 result.lineNumber = lineNumber; |
11731 result.content = content; | 11743 result.content = content; |
11732 size_t newLength = content.length(); | 11744 size_t newLength = content.length(); |
11733 while (newLength > 0 && isHTMLSpace(result.content[newLength - 1])) | 11745 while (newLength > 0 && isHTMLSpace(result.content[newLength - 1])) |
11734 --newLength; | 11746 --newLength; |
11735 result.content.setLength(newLength); | 11747 result.content.setLength(newLength); |
11736 return result; | 11748 return result; |
11737 } | 11749 } |
11738 | 11750 |
11739 } | 11751 } |
OLD | NEW |