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

Unified Diff: Source/core/css/parser/CSSParserImpl.cpp

Issue 1053953002: CSS Parser: Handle at-rules in declaration lists (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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/parser/CSSParserImpl.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/parser/CSSParserImpl.cpp
diff --git a/Source/core/css/parser/CSSParserImpl.cpp b/Source/core/css/parser/CSSParserImpl.cpp
index 9c96ffdd9356d2e7cd1972baf01ec46efd5375b7..5f3bcc1d45be32406d74c6f583177f11dc94e5da 100644
--- a/Source/core/css/parser/CSSParserImpl.cpp
+++ b/Source/core/css/parser/CSSParserImpl.cpp
@@ -148,7 +148,7 @@ bool CSSParserImpl::supportsDeclaration(CSSParserTokenRange& range)
static CSSParserImpl::AllowedRulesType computeNewAllowedRules(CSSParserImpl::AllowedRulesType allowedRules, StyleRuleBase* rule)
{
- if (!rule || allowedRules == CSSParserImpl::KeyframeRules)
+ if (!rule || allowedRules == CSSParserImpl::KeyframeRules || allowedRules == CSSParserImpl::NoRules)
return allowedRules;
ASSERT(allowedRules <= CSSParserImpl::RegularRules);
if (rule->isCharsetRule() || rule->isImportRule())
@@ -235,6 +235,8 @@ PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParserImpl::consumeAtRule(CSSParserToke
CSSParserTokenRange block = range.consumeBlock();
if (allowedRules == KeyframeRules)
return nullptr; // Parse error, no at-rules supported inside @keyframes
+ if (allowedRules == NoRules)
+ return nullptr; // Parse error, no at-rules supported inside declaration lists
ASSERT(allowedRules <= RegularRules);
@@ -516,8 +518,12 @@ void CSSParserImpl::consumeDeclarationList(CSSParserTokenRange range, StyleRule:
consumeDeclaration(range.makeSubRange(declarationStart, &range.peek()), ruleType);
break;
}
- default: // Parser error
- // FIXME: The spec allows at-rules in a declaration list
+ case AtKeywordToken: {
+ RefPtrWillBeRawPtr<StyleRuleBase> rule = consumeAtRule(range, NoRules);
+ ASSERT(!rule);
+ break;
+ }
+ default: // Parse error, unexpected token in declaration list
while (!range.atEnd() && range.peek().type() != SemicolonToken)
range.consumeComponentValue();
break;
« no previous file with comments | « Source/core/css/parser/CSSParserImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698