Chromium Code Reviews| 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 9323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9334 // contains '-'. Otherwise toASCIILowerUnchecked('\r') would be equal to '-'. | 9334 // contains '-'. Otherwise toASCIILowerUnchecked('\r') would be equal to '-'. |
| 9335 ASSERT((*constantString >= 'a' && *constantString <= 'z') || *constantSt ring == '-'); | 9335 ASSERT((*constantString >= 'a' && *constantString <= 'z') || *constantSt ring == '-'); |
| 9336 ASSERT(*constantString != '-' || isCSSLetter(*cssString)); | 9336 ASSERT(*constantString != '-' || isCSSLetter(*cssString)); |
| 9337 if (toASCIILowerUnchecked(*cssString++) != (*constantString++)) | 9337 if (toASCIILowerUnchecked(*cssString++) != (*constantString++)) |
| 9338 return false; | 9338 return false; |
| 9339 } while (*constantString); | 9339 } while (*constantString); |
| 9340 return true; | 9340 return true; |
| 9341 } | 9341 } |
| 9342 | 9342 |
| 9343 template <typename CharacterType> | 9343 template <typename CharacterType> |
| 9344 static inline bool isEqualToCSSCaseSensitiveIdentifier(CharacterType* string, co nst char* constantString) | |
| 9345 { | |
|
alancutter (OOO until 2018)
2013/05/29 13:19:44
I would add an ASSERT(*constantString) here lest t
| |
| 9346 do { | |
| 9347 if (*string++ != *constantString++) | |
| 9348 return false; | |
| 9349 } while (*constantString); | |
| 9350 return true; | |
| 9351 } | |
| 9352 | |
| 9353 template <typename CharacterType> | |
| 9344 static CharacterType* checkAndSkipEscape(CharacterType* currentCharacter) | 9354 static CharacterType* checkAndSkipEscape(CharacterType* currentCharacter) |
| 9345 { | 9355 { |
| 9346 // Returns with 0, if escape check is failed. Otherwise | 9356 // Returns with 0, if escape check is failed. Otherwise |
| 9347 // it returns with the following character. | 9357 // it returns with the following character. |
| 9348 ASSERT(*currentCharacter == '\\'); | 9358 ASSERT(*currentCharacter == '\\'); |
| 9349 | 9359 |
| 9350 ++currentCharacter; | 9360 ++currentCharacter; |
| 9351 if (!isCSSEscape(*currentCharacter)) | 9361 if (!isCSSEscape(*currentCharacter)) |
| 9352 return 0; | 9362 return 0; |
| 9353 | 9363 |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10251 } | 10261 } |
| 10252 } | 10262 } |
| 10253 | 10263 |
| 10254 template <typename CharacterType> | 10264 template <typename CharacterType> |
| 10255 inline bool CSSParser::detectCSSVariablesToken(int length) | 10265 inline bool CSSParser::detectCSSVariablesToken(int length) |
| 10256 { | 10266 { |
| 10257 ASSERT(tokenStart<CharacterType>()[0] == '-'); | 10267 ASSERT(tokenStart<CharacterType>()[0] == '-'); |
| 10258 if (length < sizeof("-webkit-var-*") - 1) | 10268 if (length < sizeof("-webkit-var-*") - 1) |
| 10259 return false; | 10269 return false; |
| 10260 CharacterType* name = tokenStart<CharacterType>(); | 10270 CharacterType* name = tokenStart<CharacterType>(); |
| 10261 return name[11] == '-' && isIdentifierStartAfterDash(name + 12) && isEqualTo CSSIdentifier(name + 1, "webkit-var"); | 10271 return name[11] == '-' && isIdentifierStartAfterDash(name + 12) && isEqualTo CSSCaseSensitiveIdentifier(name + 1, "webkit-var"); |
| 10262 } | 10272 } |
| 10263 | 10273 |
| 10264 | 10274 |
| 10265 template <typename SrcCharacterType> | 10275 template <typename SrcCharacterType> |
| 10266 int CSSParser::realLex(void* yylvalWithoutType) | 10276 int CSSParser::realLex(void* yylvalWithoutType) |
| 10267 { | 10277 { |
| 10268 YYSTYPE* yylval = static_cast<YYSTYPE*>(yylvalWithoutType); | 10278 YYSTYPE* yylval = static_cast<YYSTYPE*>(yylvalWithoutType); |
| 10269 // Write pointer for the next character. | 10279 // Write pointer for the next character. |
| 10270 SrcCharacterType* result; | 10280 SrcCharacterType* result; |
| 10271 CSSParserString resultString; | 10281 CSSParserString resultString; |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11742 { | 11752 { |
| 11743 // The tokenizer checks for the construct of an+b. | 11753 // The tokenizer checks for the construct of an+b. |
| 11744 // However, since the {ident} rule precedes the {nth} rule, some of those | 11754 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11745 // tokens are identified as string literal. Furthermore we need to accept | 11755 // tokens are identified as string literal. Furthermore we need to accept |
| 11746 // "odd" and "even" which does not match to an+b. | 11756 // "odd" and "even" which does not match to an+b. |
| 11747 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11757 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11748 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11758 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11749 } | 11759 } |
| 11750 | 11760 |
| 11751 } | 11761 } |
| OLD | NEW |