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 10229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10240 if (isASCIIAlphaCaselessEqual(name[0], 'o') && isASCIIAlphaCaselessEqual
(name[1], 'r')) | 10240 if (isASCIIAlphaCaselessEqual(name[0], 'o') && isASCIIAlphaCaselessEqual
(name[1], 'r')) |
10241 m_token = SUPPORTS_OR; | 10241 m_token = SUPPORTS_OR; |
10242 } else if (length == 3) { | 10242 } else if (length == 3) { |
10243 if (isASCIIAlphaCaselessEqual(name[0], 'a') && isASCIIAlphaCaselessEqual
(name[1], 'n') && isASCIIAlphaCaselessEqual(name[2], 'd')) | 10243 if (isASCIIAlphaCaselessEqual(name[0], 'a') && isASCIIAlphaCaselessEqual
(name[1], 'n') && isASCIIAlphaCaselessEqual(name[2], 'd')) |
10244 m_token = SUPPORTS_AND; | 10244 m_token = SUPPORTS_AND; |
10245 else if (isASCIIAlphaCaselessEqual(name[0], 'n') && isASCIIAlphaCaseless
Equal(name[1], 'o') && isASCIIAlphaCaselessEqual(name[2], 't')) | 10245 else if (isASCIIAlphaCaselessEqual(name[0], 'n') && isASCIIAlphaCaseless
Equal(name[1], 'o') && isASCIIAlphaCaselessEqual(name[2], 't')) |
10246 m_token = SUPPORTS_NOT; | 10246 m_token = SUPPORTS_NOT; |
10247 } | 10247 } |
10248 } | 10248 } |
10249 | 10249 |
| 10250 template <typename CharacterType> |
| 10251 inline bool CSSParser::detectCSSVariablesToken(int length) |
| 10252 { |
| 10253 ASSERT(tokenStart<CharacterType>()[0] == '-'); |
| 10254 if (length < sizeof("-webkit-var-*") - 1) |
| 10255 return false; |
| 10256 CharacterType* name = tokenStart<CharacterType>(); |
| 10257 return name[11] == '-' && isIdentifierStartAfterDash(name + 12) && isEqualTo
CSSIdentifier(name + 1, "webkit-var"); |
| 10258 } |
| 10259 |
| 10260 |
10250 template <typename SrcCharacterType> | 10261 template <typename SrcCharacterType> |
10251 int CSSParser::realLex(void* yylvalWithoutType) | 10262 int CSSParser::realLex(void* yylvalWithoutType) |
10252 { | 10263 { |
10253 YYSTYPE* yylval = static_cast<YYSTYPE*>(yylvalWithoutType); | 10264 YYSTYPE* yylval = static_cast<YYSTYPE*>(yylvalWithoutType); |
10254 // Write pointer for the next character. | 10265 // Write pointer for the next character. |
10255 SrcCharacterType* result; | 10266 SrcCharacterType* result; |
10256 CSSParserString resultString; | 10267 CSSParserString resultString; |
10257 bool hasEscape; | 10268 bool hasEscape; |
10258 | 10269 |
10259 // The input buffer is terminated by a \0 character, so | 10270 // The input buffer is terminated by a \0 character, so |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10423 m_token = dotSeen ? FLOATTOKEN : INTEGER; | 10434 m_token = dotSeen ? FLOATTOKEN : INTEGER; |
10424 break; | 10435 break; |
10425 } | 10436 } |
10426 | 10437 |
10427 case CharacterDash: | 10438 case CharacterDash: |
10428 if (isIdentifierStartAfterDash(currentCharacter<SrcCharacterType>())) { | 10439 if (isIdentifierStartAfterDash(currentCharacter<SrcCharacterType>())) { |
10429 --currentCharacter<SrcCharacterType>(); | 10440 --currentCharacter<SrcCharacterType>(); |
10430 parseIdentifier(result, resultString, hasEscape); | 10441 parseIdentifier(result, resultString, hasEscape); |
10431 m_token = IDENT; | 10442 m_token = IDENT; |
10432 | 10443 |
10433 if (cssVariablesEnabled() && isEqualToCSSIdentifier(tokenStart<SrcCh
aracterType>() + 1, "webkit-var") && tokenStart<SrcCharacterType>()[11] == '-' &
& isIdentifierStartAfterDash(tokenStart<SrcCharacterType>() + 12)) | 10444 if (cssVariablesEnabled() && detectCSSVariablesToken<SrcCharacterTyp
e>(result - tokenStart<SrcCharacterType>())) |
10434 m_token = VAR_DEFINITION; | 10445 m_token = VAR_DEFINITION; |
10435 else if (*currentCharacter<SrcCharacterType>() == '(') { | 10446 else if (*currentCharacter<SrcCharacterType>() == '(') { |
10436 m_token = FUNCTION; | 10447 m_token = FUNCTION; |
10437 if (!hasEscape) | 10448 if (!hasEscape) |
10438 detectDashToken<SrcCharacterType>(result - tokenStart<SrcCha
racterType>()); | 10449 detectDashToken<SrcCharacterType>(result - tokenStart<SrcCha
racterType>()); |
10439 ++currentCharacter<SrcCharacterType>(); | 10450 ++currentCharacter<SrcCharacterType>(); |
10440 ++result; | 10451 ++result; |
10441 } else if (UNLIKELY(m_parsingMode == NthChildMode) && !hasEscape &&
isASCIIAlphaCaselessEqual(tokenStart<SrcCharacterType>()[1], 'n')) { | 10452 } else if (UNLIKELY(m_parsingMode == NthChildMode) && !hasEscape &&
isASCIIAlphaCaselessEqual(tokenStart<SrcCharacterType>()[1], 'n')) { |
10442 if (result - tokenStart<SrcCharacterType>() == 2) { | 10453 if (result - tokenStart<SrcCharacterType>() == 2) { |
10443 // String "-n" is IDENT but "-n+1" is NTH. | 10454 // String "-n" is IDENT but "-n+1" is NTH. |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11700 result.lineNumber = lineNumber; | 11711 result.lineNumber = lineNumber; |
11701 result.content = content; | 11712 result.content = content; |
11702 size_t newLength = content.length(); | 11713 size_t newLength = content.length(); |
11703 while (newLength > 0 && isHTMLSpace(result.content[newLength - 1])) | 11714 while (newLength > 0 && isHTMLSpace(result.content[newLength - 1])) |
11704 --newLength; | 11715 --newLength; |
11705 result.content.setLength(newLength); | 11716 result.content.setLength(newLength); |
11706 return result; | 11717 return result; |
11707 } | 11718 } |
11708 | 11719 |
11709 } | 11720 } |
OLD | NEW |