Title: [292455] trunk/Source/WebCore
Revision
292455
Author
an...@apple.com
Date
2022-04-06 02:16:42 -0700 (Wed, 06 Apr 2022)

Log Message

Remove some @apply leftover code
https://bugs.webkit.org/show_bug.cgi?id=238857

Reviewed by Tim Nguyen.

@apply is not a thing.

* css/CSSVariableData.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeDeclarationList):
* css/parser/CSSParserImpl.h:
* css/parser/CSSVariableParser.cpp:
(WebCore::classifyBlock):
(WebCore::isValidVariableReference):
(WebCore::isValidConstantReference):
(WebCore::classifyVariableRange):
(WebCore::CSSVariableParser::containsValidVariableReferences):
(WebCore::CSSVariableParser::parseDeclarationValue):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (292454 => 292455)


--- trunk/Source/WebCore/ChangeLog	2022-04-06 09:04:59 UTC (rev 292454)
+++ trunk/Source/WebCore/ChangeLog	2022-04-06 09:16:42 UTC (rev 292455)
@@ -1,3 +1,25 @@
+2022-04-06  Antti Koivisto  <an...@apple.com>
+
+        Remove some @apply leftover code
+        https://bugs.webkit.org/show_bug.cgi?id=238857
+
+        Reviewed by Tim Nguyen.
+
+        @apply is not a thing.
+
+        * css/CSSVariableData.h:
+        * css/parser/CSSParserImpl.cpp:
+        (WebCore::CSSParserImpl::consumeAtRule):
+        (WebCore::CSSParserImpl::consumeDeclarationList):
+        * css/parser/CSSParserImpl.h:
+        * css/parser/CSSVariableParser.cpp:
+        (WebCore::classifyBlock):
+        (WebCore::isValidVariableReference):
+        (WebCore::isValidConstantReference):
+        (WebCore::classifyVariableRange):
+        (WebCore::CSSVariableParser::containsValidVariableReferences):
+        (WebCore::CSSVariableParser::parseDeclarationValue):
+
 2022-04-06  Youenn Fablet  <you...@apple.com>
 
         Remove Notification::m_relatedNotificationIdentifier

Modified: trunk/Source/WebCore/css/CSSVariableData.h (292454 => 292455)


--- trunk/Source/WebCore/css/CSSVariableData.h	2022-04-06 09:04:59 UTC (rev 292454)
+++ trunk/Source/WebCore/css/CSSVariableData.h	2022-04-06 09:16:42 UTC (rev 292455)
@@ -59,8 +59,6 @@
 
     String m_backingString;
     Vector<CSSParserToken> m_tokens;
-
-    // FIXME-NEWPARSER: We want to cache StyleProperties once we support @apply.
 };
 
 } // namespace WebCore

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/CSSParserImpl.h (292454 => 292455)


--- trunk/Source/WebCore/css/parser/CSSParserImpl.h	2022-04-06 09:04:59 UTC (rev 292454)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.h	2022-04-06 09:16:42 UTC (rev 292455)
@@ -82,7 +82,6 @@
         AllowNamespaceRules,
         RegularRules,
         KeyframeRules,
-        ApplyRules, // For @apply inside style rules
         CounterStyleRules,
         NoRules, // For parsing at-rules inside declaration lists
     };

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;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to