Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (292454 => 292455)
--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp 2022-04-06 09:04:59 UTC (rev 292454)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp 2022-04-06 09:16:42 UTC (rev 292455)
@@ -431,8 +431,8 @@
CSSParserTokenRange block = range.consumeBlock();
if (allowedRules == KeyframeRules)
return nullptr; // Parse error, no at-rules supported inside @keyframes
- if (allowedRules == NoRules || allowedRules == ApplyRules)
- return nullptr; // Parse error, no at-rules with blocks supported inside declaration lists
+ if (allowedRules == NoRules)
+ return nullptr;
ASSERT(allowedRules <= RegularRules);
@@ -977,9 +977,7 @@
break;
}
case AtKeywordToken: {
- // FIXME-NEWPARSER: Support apply
- AllowedRulesType allowedRules = /* ruleType == StyleRuleType::Style && RuntimeEnabledFeatures::cssApplyAtRulesEnabled() ? ApplyRules :*/ NoRules;
- RefPtr<StyleRuleBase> rule = consumeAtRule(range, allowedRules);
+ RefPtr<StyleRuleBase> rule = consumeAtRule(range, NoRules);
ASSERT_UNUSED(rule, !rule);
break;
}
Modified: trunk/Source/WebCore/css/parser/CSSVariableParser.cpp (292454 => 292455)
--- trunk/Source/WebCore/css/parser/CSSVariableParser.cpp 2022-04-06 09:04:59 UTC (rev 292454)
+++ trunk/Source/WebCore/css/parser/CSSVariableParser.cpp 2022-04-06 09:16:42 UTC (rev 292455)
@@ -57,10 +57,10 @@
return token.type() == IdentToken;
}
-static bool isValidVariableReference(CSSParserTokenRange, bool& hasAtApplyRule, const CSSParserContext&);
-static bool isValidConstantReference(CSSParserTokenRange, bool& hasAtApplyRule, const CSSParserContext&);
+static bool isValidVariableReference(CSSParserTokenRange, const CSSParserContext&);
+static bool isValidConstantReference(CSSParserTokenRange, const CSSParserContext&);
-static bool classifyBlock(CSSParserTokenRange range, bool& hasReferences, bool& hasAtApplyRule, const CSSParserContext& parserContext, bool isTopLevelBlock = true)
+static bool classifyBlock(CSSParserTokenRange range, bool& hasReferences, const CSSParserContext& parserContext, bool isTopLevelBlock = true)
{
while (!range.atEnd()) {
if (range.peek().getBlockType() == CSSParserToken::BlockStart) {
@@ -67,18 +67,18 @@
const CSSParserToken& token = range.peek();
CSSParserTokenRange block = range.consumeBlock();
if (token.functionId() == CSSValueVar) {
- if (!isValidVariableReference(block, hasAtApplyRule, parserContext))
+ if (!isValidVariableReference(block, parserContext))
return false; // Bail if any references are invalid
hasReferences = true;
continue;
}
if (token.functionId() == CSSValueEnv && parserContext.constantPropertiesEnabled) {
- if (!isValidConstantReference(block, hasAtApplyRule, parserContext))
+ if (!isValidConstantReference(block, parserContext))
return false; // Bail if any references are invalid
hasReferences = true;
continue;
}
- if (!classifyBlock(block, hasReferences, hasAtApplyRule, parserContext, false))
+ if (!classifyBlock(block, hasReferences, parserContext, false))
return false;
continue;
}
@@ -87,17 +87,8 @@
const CSSParserToken& token = range.consume();
switch (token.type()) {
- case AtKeywordToken: {
- if (equalIgnoringASCIICase(token.value(), "apply")) {
- range.consumeWhitespace();
- const CSSParserToken& variableName = range.consumeIncludingWhitespace();
- if (!CSSVariableParser::isValidVariableName(variableName)
- || !(range.atEnd() || range.peek().type() == SemicolonToken || range.peek().type() == RightBraceToken))
- return false;
- hasAtApplyRule = true;
- }
+ case AtKeywordToken:
break;
- }
case DelimiterToken: {
if (token.delimiter() == '!' && isTopLevelBlock)
return false;
@@ -120,7 +111,7 @@
return true;
}
-bool isValidVariableReference(CSSParserTokenRange range, bool& hasAtApplyRule, const CSSParserContext& parserContext)
+bool isValidVariableReference(CSSParserTokenRange range, const CSSParserContext& parserContext)
{
range.consumeWhitespace();
if (!CSSVariableParser::isValidVariableName(range.consumeIncludingWhitespace()))
@@ -134,10 +125,10 @@
return true;
bool hasReferences = false;
- return classifyBlock(range, hasReferences, hasAtApplyRule, parserContext);
+ return classifyBlock(range, hasReferences, parserContext);
}
-bool isValidConstantReference(CSSParserTokenRange range, bool& hasAtApplyRule, const CSSParserContext& parserContext)
+bool isValidConstantReference(CSSParserTokenRange range, const CSSParserContext& parserContext)
{
range.consumeWhitespace();
if (!isValidConstantName(range.consumeIncludingWhitespace()))
@@ -151,13 +142,12 @@
return true;
bool hasReferences = false;
- return classifyBlock(range, hasReferences, hasAtApplyRule, parserContext);
+ return classifyBlock(range, hasReferences, parserContext);
}
-static CSSValueID classifyVariableRange(CSSParserTokenRange range, bool& hasReferences, bool& hasAtApplyRule, const CSSParserContext& parserContext)
+static CSSValueID classifyVariableRange(CSSParserTokenRange range, bool& hasReferences, const CSSParserContext& parserContext)
{
hasReferences = false;
- hasAtApplyRule = false;
range.consumeWhitespace();
if (range.peek().type() == IdentToken) {
@@ -166,7 +156,7 @@
return id;
}
- if (classifyBlock(range, hasReferences, hasAtApplyRule, parserContext))
+ if (classifyBlock(range, hasReferences, parserContext))
return CSSValueInternalVariableValue;
return CSSValueInvalid;
}
@@ -174,9 +164,8 @@
bool CSSVariableParser::containsValidVariableReferences(CSSParserTokenRange range, const CSSParserContext& parserContext)
{
bool hasReferences;
- bool hasAtApplyRule;
- CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule, parserContext);
- return type == CSSValueInternalVariableValue && hasReferences && !hasAtApplyRule;
+ CSSValueID type = classifyVariableRange(range, hasReferences, parserContext);
+ return type == CSSValueInternalVariableValue && hasReferences;
}
RefPtr<CSSCustomPropertyValue> CSSVariableParser::parseDeclarationValue(const AtomString& variableName, CSSParserTokenRange range, const CSSParserContext& parserContext)
@@ -185,8 +174,7 @@
return nullptr;
bool hasReferences;
- bool hasAtApplyRule;
- CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule, parserContext);
+ CSSValueID type = classifyVariableRange(range, hasReferences, parserContext);
if (type == CSSValueInvalid)
return nullptr;