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

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: Fixed silly mistake 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 afd38282f1f58ee546f393c5cad2003f61e77870..83246da05126621579ab9bff0dbbc369bd42c317 100644
--- a/Source/core/css/CSSParser.cpp
+++ b/Source/core/css/CSSParser.cpp
@@ -10247,6 +10247,17 @@ inline void CSSParser::detectSupportsToken(int length)
}
}
+template <typename CharacterType>
+inline bool CSSParser::detectCSSVariablesToken(int length)
+{
+ ASSERT(tokenStart<CharacterType>()[0] == '-');
+ if (length < sizeof("-webkit-var-*") - 1)
+ return false;
+ CharacterType* name = tokenStart<CharacterType>();
+ return name[11] == '-' && isIdentifierStartAfterDash(name + 12) && isEqualToCSSIdentifier(name + 1, "webkit-var");
+}
+
+
template <typename SrcCharacterType>
int CSSParser::realLex(void* yylvalWithoutType)
{
@@ -10430,7 +10441,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