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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 2288633002: Recognise variable names when parsing CSS property names (Closed)
Patch Set: Created 4 years, 4 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
Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 049f9129408633b4b841f1a889d120b02bd2f1c7..795d84108f0281fc6e69497b2abcf61b90156fa1 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -165,6 +165,9 @@ bool CSSPropertyParser::parseValueStart(CSSPropertyID unresolvedProperty, bool i
template <typename CharacterType>
static CSSPropertyID unresolvedCSSPropertyID(const CharacterType* propertyName, unsigned length)
{
+ if (length >= 2 && propertyName[0] == '-' && propertyName[1] == '-')
Timothy Loh 2016/08/29 04:01:37 I duplicated the logic because the argument to CSS
+ return CSSPropertyVariable;
+
char buffer[maxCSSPropertyNameLength + 1]; // 1 for null character
for (unsigned i = 0; i != length; ++i) {
@@ -297,7 +300,7 @@ static CSSValue* consumeWillChange(CSSParserTokenRange& range)
if (range.peek().type() != IdentToken)
return nullptr;
CSSPropertyID unresolvedProperty = unresolvedCSSPropertyID(range.peek().value());
- if (unresolvedProperty) {
+ if (unresolvedProperty != CSSPropertyInvalid && unresolvedProperty != CSSPropertyVariable) {
ASSERT(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty));
// Now "all" is used by both CSSValue and CSSPropertyValue.
// Need to return nullptr when currentValue is CSSPropertyAll.
@@ -1128,10 +1131,11 @@ static CSSValue* consumeTransitionProperty(CSSParserTokenRange& range)
if (token.id() == CSSValueNone)
return consumeIdent(range);
- if (CSSPropertyID property = token.parseAsUnresolvedCSSPropertyID()) {
- ASSERT(CSSPropertyMetadata::isEnabledProperty(property));
+ CSSPropertyID unresolvedProperty = token.parseAsUnresolvedCSSPropertyID();
+ if (unresolvedProperty != CSSPropertyInvalid && unresolvedProperty != CSSPropertyVariable) {
+ DCHECK(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty));
range.consumeIncludingWhitespace();
- return CSSCustomIdentValue::create(property);
+ return CSSCustomIdentValue::create(unresolvedProperty);
}
return consumeCustomIdent(range);
}

Powered by Google App Engine
This is Rietveld 408576698