Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Unified Diff: Source/core/css/CSSParser.cpp

Issue 15317009: Fix for CSS Variables tokenisation not checking CSS identifier length (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSParser.cpp
diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser.cpp
index 4861b11c90cc9dc518137ba88af49a1eed450080..61b0e33a63ee140945a64e067701a6b5e83f0084 100644
--- a/Source/core/css/CSSParser.cpp
+++ b/Source/core/css/CSSParser.cpp
@@ -10307,6 +10307,18 @@ inline void CSSParser::detectSupportsToken(int length)
}
}
+template <typename CharacterType>
+inline bool CSSParser::detectCSSVariablesToken(int length)
+{
+ 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
+ CharacterType* name = tokenStart<CharacterType>();
+ if (name[11] == '-' && isEqualToCSSIdentifier(name + 1, "webkit-var"))
+ return true;
+ }
+ return false;
+}
+
+
template <typename SrcCharacterType>
int CSSParser::realLex(void* yylvalWithoutType)
{
@@ -10491,7 +10503,7 @@ restartAfterComment:
parseIdentifier(result, resultString, hasEscape);
m_token = IDENT;
- if (cssVariablesEnabled() && isEqualToCSSIdentifier(tokenStart<SrcCharacterType>() + 1, "webkit-var") && tokenStart<SrcCharacterType>()[11] == '-' && isIdentifierStartAfterDash(tokenStart<SrcCharacterType>() + 12))
+ if (cssVariablesEnabled() && detectCSSVariablesToken<SrcCharacterType>(result - tokenStart<SrcCharacterType>()))
m_token = VAR_DEFINITION;
else if (*currentCharacter<SrcCharacterType>() == '(') {
m_token = FUNCTION;
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698