Title: [285373] trunk/Source/WebCore
Revision
285373
Author
[email protected]
Date
2021-11-06 12:20:59 -0700 (Sat, 06 Nov 2021)

Log Message

Remove separate classes for CSS wide keywords (initial/inherit/unset/revert)
https://bugs.webkit.org/show_bug.cgi?id=232750

Reviewed by Sam Weinig.

Remove CSSInitialValue, CSSInheritedValue, CSSRevertValue and CSSUnsetValue classes.
They can all be handled by CSSPrimitiveValue.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDeprecatedCSSOMValueCustom.cpp:
(WebCore::toJSNewlyCreated):

Avoid changing the class type visible in CSSOM.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::renderTextDecorationStyleFlagsToCSSValue):
(WebCore::renderTextDecorationSkipToCSSValue):
* css/CSSInheritedValue.cpp: Removed.
* css/CSSInheritedValue.h: Removed.
* css/CSSInitialValue.cpp: Removed.
* css/CSSInitialValue.h: Removed.
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::isCSSWideKeyword const):
* css/CSSPrimitiveValue.h:
* css/CSSRevertValue.cpp: Removed.
* css/CSSRevertValue.h: Removed.
* css/CSSUnsetValue.cpp: Removed.
* css/CSSUnsetValue.h: Removed.
* css/CSSValue.cpp:
(WebCore::CSSValue::cssValueType const):
(WebCore::CSSValue::equals const):
(WebCore::CSSValue::cssText const):
(WebCore::CSSValue::destroy):
(WebCore::CSSValue::treatAsInheritedValue const):
(WebCore::CSSValue::treatAsInitialValue const):
(WebCore::CSSValue::isInitialValue const):
(WebCore::CSSValue::isImplicitInitialValue const):
(WebCore::CSSValue::isInheritValue const):
(WebCore::CSSValue::isUnsetValue const):
(WebCore::CSSValue::isRevertValue const):
(WebCore::CSSValue::isCSSWideKeyword const):
* css/CSSValue.h:
(WebCore::CSSValue::CSSValue):
(WebCore::CSSValue::isInheritedValue const): Deleted.
(WebCore::CSSValue::isInitialValue const): Deleted.
(WebCore::CSSValue::isUnsetValue const): Deleted.
(WebCore::CSSValue::isRevertValue const): Deleted.
(WebCore::CSSValue::isGlobalKeyword const): Deleted.
* css/CSSValuePool.cpp:
(WebCore::StaticCSSValuePool::StaticCSSValuePool):
* css/CSSValuePool.h:
(WebCore::CSSValuePool::createImplicitInitialValue):
(WebCore::CSSValuePool::createInheritedValue): Deleted.
(WebCore::CSSValuePool::createExplicitInitialValue): Deleted.
(WebCore::CSSValuePool::createUnsetValue): Deleted.
(WebCore::CSSValuePool::createRevertValue): Deleted.
* css/DeprecatedCSSOMPrimitiveValue.h:
(WebCore::DeprecatedCSSOMPrimitiveValue::isCSSWideKeyword const):
* css/SelectorChecker.cpp:
* css/StyleProperties.cpp:
(WebCore::StyleProperties::borderRadiusValue const):
(WebCore::StyleProperties::pageBreakPropertyValue const):
* css/parser/CSSParserFastPaths.cpp:
(WebCore::parseKeywordValue):
* css/parser/CSSParserIdioms.h:
(WebCore::isCSSWideKeyword):
(WebCore::isValidCustomIdentifier):

Separate the concept of valid custom identifier from that of CSS-wide keyword. The former also excludes the obsolete "default" keyword.

* css/parser/CSSPropertyParser.cpp:
(WebCore::maybeConsumeCSSWideKeyword):
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
(WebCore::CSSPropertyParserHelpers::concatenateFamilyName):
(WebCore::CSSPropertyParserHelpers::isCSSWideKeyword): Deleted.
* editing/EditingStyle.cpp:
(WebCore::fontWeightIsBold):
* editing/cocoa/HTMLConverter.mm:
(HTMLConverterCaches::propertyValueForNode):
(HTMLConverterCaches::floatPropertyValueForNode):
(HTMLConverterCaches::colorPropertyValueForNode):
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::createSharedCellStyle const):
* style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::addMatchedProperties):
* style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::addMatch):
(WebCore::Style::PropertyCascade::resolveDirectionAndWritingMode const):
* style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyProperty):
(WebCore::Style::Builder::resolveValue):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::parseAttribute):

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285372 => 285373)


--- trunk/Source/WebCore/ChangeLog	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/ChangeLog	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1,3 +1,103 @@
+2021-11-06  Antti Koivisto  <[email protected]>
+
+        Remove separate classes for CSS wide keywords (initial/inherit/unset/revert)
+        https://bugs.webkit.org/show_bug.cgi?id=232750
+
+        Reviewed by Sam Weinig.
+
+        Remove CSSInitialValue, CSSInheritedValue, CSSRevertValue and CSSUnsetValue classes.
+        They can all be handled by CSSPrimitiveValue.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSDeprecatedCSSOMValueCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+
+        Avoid changing the class type visible in CSSOM.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::renderTextDecorationStyleFlagsToCSSValue):
+        (WebCore::renderTextDecorationSkipToCSSValue):
+        * css/CSSInheritedValue.cpp: Removed.
+        * css/CSSInheritedValue.h: Removed.
+        * css/CSSInitialValue.cpp: Removed.
+        * css/CSSInitialValue.h: Removed.
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::isCSSWideKeyword const):
+        * css/CSSPrimitiveValue.h:
+        * css/CSSRevertValue.cpp: Removed.
+        * css/CSSRevertValue.h: Removed.
+        * css/CSSUnsetValue.cpp: Removed.
+        * css/CSSUnsetValue.h: Removed.
+        * css/CSSValue.cpp:
+        (WebCore::CSSValue::cssValueType const):
+        (WebCore::CSSValue::equals const):
+        (WebCore::CSSValue::cssText const):
+        (WebCore::CSSValue::destroy):
+        (WebCore::CSSValue::treatAsInheritedValue const):
+        (WebCore::CSSValue::treatAsInitialValue const):
+        (WebCore::CSSValue::isInitialValue const):
+        (WebCore::CSSValue::isImplicitInitialValue const):
+        (WebCore::CSSValue::isInheritValue const):
+        (WebCore::CSSValue::isUnsetValue const):
+        (WebCore::CSSValue::isRevertValue const):
+        (WebCore::CSSValue::isCSSWideKeyword const):
+        * css/CSSValue.h:
+        (WebCore::CSSValue::CSSValue):
+        (WebCore::CSSValue::isInheritedValue const): Deleted.
+        (WebCore::CSSValue::isInitialValue const): Deleted.
+        (WebCore::CSSValue::isUnsetValue const): Deleted.
+        (WebCore::CSSValue::isRevertValue const): Deleted.
+        (WebCore::CSSValue::isGlobalKeyword const): Deleted.
+        * css/CSSValuePool.cpp:
+        (WebCore::StaticCSSValuePool::StaticCSSValuePool):
+        * css/CSSValuePool.h:
+        (WebCore::CSSValuePool::createImplicitInitialValue):
+        (WebCore::CSSValuePool::createInheritedValue): Deleted.
+        (WebCore::CSSValuePool::createExplicitInitialValue): Deleted.
+        (WebCore::CSSValuePool::createUnsetValue): Deleted.
+        (WebCore::CSSValuePool::createRevertValue): Deleted.
+        * css/DeprecatedCSSOMPrimitiveValue.h:
+        (WebCore::DeprecatedCSSOMPrimitiveValue::isCSSWideKeyword const):
+        * css/SelectorChecker.cpp:
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::borderRadiusValue const):
+        (WebCore::StyleProperties::pageBreakPropertyValue const):
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::parseKeywordValue):
+        * css/parser/CSSParserIdioms.h:
+        (WebCore::isCSSWideKeyword):
+        (WebCore::isValidCustomIdentifier):
+
+        Separate the concept of valid custom identifier from that of CSS-wide keyword. The former also excludes the obsolete "default" keyword.
+
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::maybeConsumeCSSWideKeyword):
+        * css/parser/CSSPropertyParserHelpers.cpp:
+        (WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
+        (WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
+        (WebCore::CSSPropertyParserHelpers::concatenateFamilyName):
+        (WebCore::CSSPropertyParserHelpers::isCSSWideKeyword): Deleted.
+        * editing/EditingStyle.cpp:
+        (WebCore::fontWeightIsBold):
+        * editing/cocoa/HTMLConverter.mm:
+        (HTMLConverterCaches::propertyValueForNode):
+        (HTMLConverterCaches::floatPropertyValueForNode):
+        (HTMLConverterCaches::colorPropertyValueForNode):
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::createSharedCellStyle const):
+        * style/ElementRuleCollector.cpp:
+        (WebCore::Style::ElementRuleCollector::addMatchedProperties):
+        * style/PropertyCascade.cpp:
+        (WebCore::Style::PropertyCascade::addMatch):
+        (WebCore::Style::PropertyCascade::resolveDirectionAndWritingMode const):
+        * style/StyleBuilder.cpp:
+        (WebCore::Style::Builder::applyProperty):
+        (WebCore::Style::Builder::resolveValue):
+        * svg/SVGFontFaceElement.cpp:
+        (WebCore::SVGFontFaceElement::parseAttribute):
+
 2021-11-06  Alan Bujtas  <[email protected]>
 
         [LFC][IFC] Build the paragraph content when all the inline items are processed

Modified: trunk/Source/WebCore/Sources.txt (285372 => 285373)


--- trunk/Source/WebCore/Sources.txt	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/Sources.txt	2021-11-06 19:20:59 UTC (rev 285373)
@@ -691,8 +691,6 @@
 css/CSSImageSetValue.cpp
 css/CSSImageValue.cpp
 css/CSSImportRule.cpp
-css/CSSInheritedValue.cpp
-css/CSSInitialValue.cpp
 css/CSSKeyframeRule.cpp
 css/CSSKeyframesRule.cpp
 css/CSSLayerRule.cpp
@@ -708,7 +706,6 @@
 css/CSSPropertySourceData.cpp
 css/CSSReflectValue.cpp
 css/CSSRegisteredCustomProperty.cpp
-css/CSSRevertValue.cpp
 css/CSSRule.cpp
 css/CSSRuleList.cpp
 css/CSSSegmentedFontFace.cpp
@@ -724,7 +721,6 @@
 css/CSSToStyleMap.cpp
 css/CSSUnicodeRangeValue.cpp
 css/CSSUnits.cpp
-css/CSSUnsetValue.cpp
 css/CSSValue.cpp
 css/CSSValueList.cpp
 css/CSSValuePair.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (285372 => 285373)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-11-06 19:20:59 UTC (rev 285373)
@@ -3532,10 +3532,8 @@
 		A80E6CFD0A1989CA007FB8C5 /* CSSFontFaceRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CD30A1989CA007FB8C5 /* CSSFontFaceRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A80E6CFF0A1989CA007FB8C5 /* CSSProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CD50A1989CA007FB8C5 /* CSSProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CD60A1989CA007FB8C5 /* CSSPageRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		A80E6D010A1989CA007FB8C5 /* CSSInheritedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CD70A1989CA007FB8C5 /* CSSInheritedValue.h */; };
 		A80E6D030A1989CA007FB8C5 /* CSSMediaRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CD90A1989CA007FB8C5 /* CSSMediaRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A80E6D040A1989CA007FB8C5 /* Counter.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CDA0A1989CA007FB8C5 /* Counter.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		A80E6D080A1989CA007FB8C5 /* CSSInitialValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CDE0A1989CA007FB8C5 /* CSSInitialValue.h */; };
 		A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CE20A1989CA007FB8C5 /* CSSStyleRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A80E6D0D0A1989CA007FB8C5 /* CSSRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CE30A1989CA007FB8C5 /* CSSRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A80E6DFC0A199067007FB8C5 /* StyleProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6DFA0A199067007FB8C5 /* StyleProperties.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4155,8 +4153,6 @@
 		BC772E131331620C001EC9CE /* CSSLineBoxContainValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC772E121331620C001EC9CE /* CSSLineBoxContainValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC779E141BB215BB00CAA8BF /* CSSCustomPropertyValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC779E131BB215BB00CAA8BF /* CSSCustomPropertyValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC779E171BB227CA00CAA8BF /* StyleCustomPropertyData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC779E151BB226A200CAA8BF /* StyleCustomPropertyData.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7D8FEE1BD03B6400FFE540 /* CSSUnsetValue.h */; };
-		BC7D8FF41BD1A47900FFE540 /* CSSRevertValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7D8FF21BD1A47900FFE540 /* CSSRevertValue.h */; };
 		BC7F44A80B9E324E00A9D081 /* ImageObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F44A70B9E324E00A9D081 /* ImageObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC7FA6210D1F0CBD00DB22A9 /* LiveNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7FA61F0D1F0CBD00DB22A9 /* LiveNodeList.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC7FA62D0D1F0EFF00DB22A9 /* StaticNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7FA62B0D1F0EFF00DB22A9 /* StaticNodeList.h */; };
@@ -13201,7 +13197,6 @@
 		A80E6CC30A1989CA007FB8C5 /* CSSFontValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSFontValue.h; sourceTree = "<group>"; };
 		A80E6CC40A1989CA007FB8C5 /* CSSValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSValue.h; sourceTree = "<group>"; };
 		A80E6CC50A1989CA007FB8C5 /* CSSStyleRule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSStyleRule.cpp; sourceTree = "<group>"; };
-		A80E6CC60A1989CA007FB8C5 /* CSSInheritedValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSInheritedValue.cpp; sourceTree = "<group>"; };
 		A80E6CC70A1989CA007FB8C5 /* CSSFontValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontValue.cpp; sourceTree = "<group>"; };
 		A80E6CC80A1989CA007FB8C5 /* CSSRuleList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSRuleList.h; sourceTree = "<group>"; };
 		A80E6CCA0A1989CA007FB8C5 /* CSSShadowValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSShadowValue.cpp; sourceTree = "<group>"; };
@@ -13216,13 +13211,10 @@
 		A80E6CD40A1989CA007FB8C5 /* CSSImageValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSImageValue.cpp; sourceTree = "<group>"; };
 		A80E6CD50A1989CA007FB8C5 /* CSSProperty.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSProperty.h; sourceTree = "<group>"; };
 		A80E6CD60A1989CA007FB8C5 /* CSSPageRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSPageRule.h; sourceTree = "<group>"; };
-		A80E6CD70A1989CA007FB8C5 /* CSSInheritedValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSInheritedValue.h; sourceTree = "<group>"; };
-		A80E6CD80A1989CA007FB8C5 /* CSSInitialValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSInitialValue.cpp; sourceTree = "<group>"; };
 		A80E6CD90A1989CA007FB8C5 /* CSSMediaRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSMediaRule.h; sourceTree = "<group>"; };
 		A80E6CDA0A1989CA007FB8C5 /* Counter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Counter.h; sourceTree = "<group>"; };
 		A80E6CDB0A1989CA007FB8C5 /* CSSPrimitiveValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPrimitiveValue.cpp; sourceTree = "<group>"; };
 		A80E6CDC0A1989CA007FB8C5 /* CSSRule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSRule.cpp; sourceTree = "<group>"; };
-		A80E6CDE0A1989CA007FB8C5 /* CSSInitialValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSInitialValue.h; sourceTree = "<group>"; };
 		A80E6CDF0A1989CA007FB8C5 /* CSSRuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSRuleList.cpp; sourceTree = "<group>"; };
 		A80E6CE20A1989CA007FB8C5 /* CSSStyleRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSStyleRule.h; sourceTree = "<group>"; };
 		A80E6CE30A1989CA007FB8C5 /* CSSRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSRule.h; sourceTree = "<group>"; };
@@ -14598,10 +14590,6 @@
 		BC779E131BB215BB00CAA8BF /* CSSCustomPropertyValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSCustomPropertyValue.h; sourceTree = "<group>"; };
 		BC779E151BB226A200CAA8BF /* StyleCustomPropertyData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleCustomPropertyData.h; sourceTree = "<group>"; };
 		BC7B2AF80450824100A8000F /* Scrollbar.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Scrollbar.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-		BC7D8FED1BD03B6400FFE540 /* CSSUnsetValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSUnsetValue.cpp; sourceTree = "<group>"; };
-		BC7D8FEE1BD03B6400FFE540 /* CSSUnsetValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSUnsetValue.h; sourceTree = "<group>"; };
-		BC7D8FF11BD1A47900FFE540 /* CSSRevertValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSRevertValue.cpp; sourceTree = "<group>"; };
-		BC7D8FF21BD1A47900FFE540 /* CSSRevertValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSRevertValue.h; sourceTree = "<group>"; };
 		BC7F44A70B9E324E00A9D081 /* ImageObserver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ImageObserver.h; sourceTree = "<group>"; };
 		BC7FA61E0D1F0CBD00DB22A9 /* LiveNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LiveNodeList.cpp; sourceTree = "<group>"; };
 		BC7FA61F0D1F0CBD00DB22A9 /* LiveNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveNodeList.h; sourceTree = "<group>"; };
@@ -18616,11 +18604,11 @@
 		1A569CC40D7E2B60007C3983 /* bridge */ = {
 			isa = PBXGroup;
 			children = (
+				59B5977111086556007159E8 /* jsc */,
 				1A569CE20D7E2B82007C3983 /* objc */,
 				599E758F11055A1F00D904FA /* Bridge.h */,
 				1A71D5790F33819000F9CE4E /* IdentifierRep.cpp */,
 				1A71D57A0F33819000F9CE4E /* IdentifierRep.h */,
-				59B5977111086556007159E8 /* jsc */,
 				1A569CEF0D7E2B82007C3983 /* runtime_array.cpp */,
 				1A569CF00D7E2B82007C3983 /* runtime_array.h */,
 				1A569CF10D7E2B82007C3983 /* runtime_method.cpp */,
@@ -29909,10 +29897,6 @@
 				A80E6CC10A1989CA007FB8C5 /* CSSImportRule.cpp */,
 				A80E6CCC0A1989CA007FB8C5 /* CSSImportRule.h */,
 				85C56CA90AA89E6600D95755 /* CSSImportRule.idl */,
-				A80E6CC60A1989CA007FB8C5 /* CSSInheritedValue.cpp */,
-				A80E6CD70A1989CA007FB8C5 /* CSSInheritedValue.h */,
-				A80E6CD80A1989CA007FB8C5 /* CSSInitialValue.cpp */,
-				A80E6CDE0A1989CA007FB8C5 /* CSSInitialValue.h */,
 				31288E6E0E3005D6003619AE /* CSSKeyframeRule.cpp */,
 				31288E6F0E3005D6003619AE /* CSSKeyframeRule.h */,
 				316FE0910E6CCD7F00BF6088 /* CSSKeyframeRule.idl */,
@@ -29956,8 +29940,6 @@
 				BC5A12DE0DC0414800C9AFAD /* CSSReflectValue.h */,
 				4B1706642162B42F00E578BB /* CSSRegisteredCustomProperty.cpp */,
 				4BDA3FFB2151B6F400FD6604 /* CSSRegisteredCustomProperty.h */,
-				BC7D8FF11BD1A47900FFE540 /* CSSRevertValue.cpp */,
-				BC7D8FF21BD1A47900FFE540 /* CSSRevertValue.h */,
 				A80E6CDC0A1989CA007FB8C5 /* CSSRule.cpp */,
 				A80E6CE30A1989CA007FB8C5 /* CSSRule.h */,
 				14CF7A7009F5CF9A00EB3665 /* CSSRule.idl */,
@@ -29996,8 +29978,6 @@
 				0F6B7077237BC12F0052CA47 /* CSSUnits.h */,
 				A80E6CCE0A1989CA007FB8C5 /* CSSUnknownRule.h */,
 				85C56CAD0AA89FE000D95755 /* CSSUnknownRule.idl */,
-				BC7D8FED1BD03B6400FFE540 /* CSSUnsetValue.cpp */,
-				BC7D8FEE1BD03B6400FFE540 /* CSSUnsetValue.h */,
 				AD03AAF81468453900A39B5B /* CSSValue.cpp */,
 				A80E6CC40A1989CA007FB8C5 /* CSSValue.h */,
 				BCEA478C097CAAC80094C9E4 /* CSSValueKeywords.in */,
@@ -32273,8 +32253,6 @@
 				9393E600151A99F200066F06 /* CSSImageSetValue.h in Headers */,
 				A80E6CFA0A1989CA007FB8C5 /* CSSImageValue.h in Headers */,
 				A80E6CF60A1989CA007FB8C5 /* CSSImportRule.h in Headers */,
-				A80E6D010A1989CA007FB8C5 /* CSSInheritedValue.h in Headers */,
-				A80E6D080A1989CA007FB8C5 /* CSSInitialValue.h in Headers */,
 				31288E730E3005D6003619AE /* CSSKeyframeRule.h in Headers */,
 				31288E750E3005D6003619AE /* CSSKeyframesRule.h in Headers */,
 				2A4107A426CB66F8003BF797 /* CSSKeywordValue.h in Headers */,
@@ -32329,7 +32307,6 @@
 				82E3D8DF122EA0D1003AE5BC /* CSSPropertySourceData.h in Headers */,
 				BC5A12E00DC0414800C9AFAD /* CSSReflectValue.h in Headers */,
 				4BDA40012151B6F500FD6604 /* CSSRegisteredCustomProperty.h in Headers */,
-				BC7D8FF41BD1A47900FFE540 /* CSSRevertValue.h in Headers */,
 				2A538A2826F0103C00965FC8 /* CSSRotate.h in Headers */,
 				A80E6D0D0A1989CA007FB8C5 /* CSSRule.h in Headers */,
 				A80E6CF20A1989CA007FB8C5 /* CSSRuleList.h in Headers */,
@@ -32363,7 +32340,6 @@
 				4BAFD0E1219242A000C0AB64 /* CSSUnitValue.h in Headers */,
 				DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */,
 				4BAFD0D921921EA000C0AB64 /* CSSUnparsedValue.h in Headers */,
-				BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */,
 				A80E6CEE0A1989CA007FB8C5 /* CSSValue.h in Headers */,
 				E3BBC24723835526006EC39F /* CSSValueKey.h in Headers */,
 				6565815109D13043000E61D7 /* CSSValueKeywords.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/JSDeprecatedCSSOMValueCustom.cpp (285372 => 285373)


--- trunk/Source/WebCore/bindings/js/JSDeprecatedCSSOMValueCustom.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/bindings/js/JSDeprecatedCSSOMValueCustom.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -51,7 +51,8 @@
 {
     if (value->isValueList())
         return createWrapper<DeprecatedCSSOMValueList>(globalObject, WTFMove(value));
-    if (value->isPrimitiveValue())
+    // Expose CSS-wide keywords as plain CSSValues to keep the existing behavior.
+    if (value->isPrimitiveValue() && !downcast<DeprecatedCSSOMPrimitiveValue>(value.get()).isCSSWideKeyword())
         return createWrapper<DeprecatedCSSOMPrimitiveValue>(globalObject, WTFMove(value));
     return createWrapper<DeprecatedCSSOMValue>(globalObject, WTFMove(value));
 }

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1652,7 +1652,7 @@
     }
 
     ASSERT_NOT_REACHED();
-    return CSSValuePool::singleton().createExplicitInitialValue();
+    return CSSValuePool::singleton().createIdentifierValue(CSSValueInitial);
 }
 
 static RefPtr<CSSValue> renderTextDecorationSkipToCSSValue(TextDecorationSkipInk textDecorationSkipInk)
@@ -1667,7 +1667,7 @@
     }
 
     ASSERT_NOT_REACHED();
-    return CSSValuePool::singleton().createExplicitInitialValue();
+    return CSSValuePool::singleton().createIdentifierValue(CSSValueInitial);
 }
 
 static Ref<CSSValue> textUnderlineOffsetToCSSValue(const TextUnderlineOffset& textUnderlineOffset)

Deleted: trunk/Source/WebCore/css/CSSInheritedValue.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/CSSInheritedValue.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSInheritedValue.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1,33 +0,0 @@
-/**
- * (C) 1999-2003 Lars Knoll ([email protected])
- * Copyright (C) 2004, 2005, 2006, 2013 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "CSSInheritedValue.h"
-
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-String CSSInheritedValue::customCSSText() const
-{
-    return "inherit"_s;
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/css/CSSInheritedValue.h (285372 => 285373)


--- trunk/Source/WebCore/css/CSSInheritedValue.h	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSInheritedValue.h	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1,44 +0,0 @@
-/*
- * (C) 1999-2003 Lars Knoll ([email protected])
- * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include "CSSValue.h"
-
-namespace WebCore {
-
-class CSSInheritedValue final : public CSSValue {
-public:
-    String customCSSText() const;
-
-    bool equals(const CSSInheritedValue&) const { return true; }
-
-private:
-    friend LazyNeverDestroyed<CSSInheritedValue>;
-    CSSInheritedValue(StaticCSSValueTag)
-        : CSSValue(InheritedClass)
-    {
-        makeStatic();
-    }
-};
-
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSInheritedValue, isInheritedValue())

Deleted: trunk/Source/WebCore/css/CSSInitialValue.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/CSSInitialValue.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSInitialValue.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1,33 +0,0 @@
-/**
- * (C) 1999-2003 Lars Knoll ([email protected])
- * Copyright (C) 2004, 2005, 2006, 2013 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "CSSInitialValue.h"
-
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-String CSSInitialValue::customCSSText() const
-{
-    return "initial"_s;
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/css/CSSInitialValue.h (285372 => 285373)


--- trunk/Source/WebCore/css/CSSInitialValue.h	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSInitialValue.h	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1,50 +0,0 @@
-/*
- * (C) 1999-2003 Lars Knoll ([email protected])
- * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include "CSSValue.h"
-
-namespace WebCore {
-
-class CSSInitialValue final : public CSSValue {
-public:
-    String customCSSText() const;
-
-    bool isImplicit() const { return m_isImplicit; }
-
-    bool equals(const CSSInitialValue&) const { return true; }
-
-private:
-    friend LazyNeverDestroyed<CSSInitialValue>;
-    CSSInitialValue(StaticCSSValueTag, bool implicit)
-        : CSSValue(InitialClass)
-        , m_isImplicit(implicit)
-    {
-        makeStatic();
-    }
-
-private:
-    bool m_isImplicit;
-};
-
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSInitialValue, isInitialValue())

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -26,6 +26,7 @@
 #include "CSSFontFamily.h"
 #include "CSSHelper.h"
 #include "CSSMarkup.h"
+#include "CSSParserIdioms.h"
 #include "CSSPrimitiveValueMappings.h"
 #include "CSSPropertyNames.h"
 #include "CSSToLengthConversionData.h"
@@ -362,6 +363,13 @@
     makeStatic();
 }
 
+CSSPrimitiveValue::CSSPrimitiveValue(StaticCSSValueTag, ImplicitInitialValueTag)
+    : CSSPrimitiveValue(CSSValueInitial)
+{
+    m_isImplicit = true;
+    makeStatic();
+}
+
 void CSSPrimitiveValue::init(const Length& length)
 {
     switch (length.type()) {
@@ -1438,4 +1446,9 @@
     }
 }
 
+bool CSSPrimitiveValue::isCSSWideKeyword() const
+{
+    return WebCore::isCSSWideKeyword(valueID());
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (285372 => 285373)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.h	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h	2021-11-06 19:20:59 UTC (rev 285373)
@@ -115,6 +115,13 @@
     bool isFlex() const { return primitiveType() == CSSUnitType::CSS_FR; }
     bool isCustomIdent() const { return primitiveUnitType() == CSSUnitType::CustomIdent; }
 
+    bool isInitialValue() const { return valueID() == CSSValueInitial; }
+    bool isImplicitInitialValue() const { return isInitialValue() && m_isImplicit; }
+    bool isInheritValue() const { return valueID() == CSSValueInherit; }
+    bool isUnsetValue() const { return valueID() == CSSValueUnset; }
+    bool isRevertValue() const { return valueID() == CSSValueRevert; }
+    bool isCSSWideKeyword() const;
+
     static Ref<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) { return adoptRef(*new CSSPrimitiveValue(valueID)); }
     static Ref<CSSPrimitiveValue> createIdentifier(CSSPropertyID propertyID) { return adoptRef(*new CSSPrimitiveValue(propertyID)); }
 
@@ -198,6 +205,7 @@
 
 private:
     friend class CSSValuePool;
+    friend class StaticCSSValuePool;
     friend LazyNeverDestroyed<CSSPrimitiveValue>;
 
     CSSPrimitiveValue(CSSValueID);
@@ -212,6 +220,8 @@
     CSSPrimitiveValue(StaticCSSValueTag, CSSValueID);
     CSSPrimitiveValue(StaticCSSValueTag, const Color&);
     CSSPrimitiveValue(StaticCSSValueTag, double, CSSUnitType);
+    enum ImplicitInitialValueTag { ImplicitInitialValue };
+    CSSPrimitiveValue(StaticCSSValueTag, ImplicitInitialValueTag);
 
     template<typename T> CSSPrimitiveValue(T); // Defined in CSSPrimitiveValueMappings.h
     template<typename T> CSSPrimitiveValue(RefPtr<T>&&);

Deleted: trunk/Source/WebCore/css/CSSRevertValue.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/CSSRevertValue.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSRevertValue.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CSSRevertValue.h"
-
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-String CSSRevertValue::customCSSText() const
-{
-    return "revert"_s;
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/css/CSSRevertValue.h (285372 => 285373)


--- trunk/Source/WebCore/css/CSSRevertValue.h	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSRevertValue.h	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "CSSValue.h"
-
-namespace WebCore {
-
-class CSSRevertValue final : public CSSValue {
-public:
-    String customCSSText() const;
-
-    bool equals(const CSSRevertValue&) const { return true; }
-
-private:
-    friend LazyNeverDestroyed<CSSRevertValue>;
-    CSSRevertValue(StaticCSSValueTag)
-        : CSSValue(RevertClass)
-    {
-        makeStatic();
-    }
-};
-
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSRevertValue, isRevertValue())

Deleted: trunk/Source/WebCore/css/CSSUnsetValue.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/CSSUnsetValue.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSUnsetValue.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CSSUnsetValue.h"
-
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-String CSSUnsetValue::customCSSText() const
-{
-    return "unset"_s;
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/css/CSSUnsetValue.h (285372 => 285373)


--- trunk/Source/WebCore/css/CSSUnsetValue.h	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSUnsetValue.h	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "CSSValue.h"
-
-namespace WebCore {
-
-class CSSUnsetValue final : public CSSValue {
-public:
-    String customCSSText() const;
-
-    bool equals(const CSSUnsetValue&) const { return true; }
-
-private:
-    friend LazyNeverDestroyed<CSSUnsetValue>;
-    CSSUnsetValue(StaticCSSValueTag)
-        : CSSValue(UnsetClass)
-    {
-        makeStatic();
-    }
-};
-
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSUnsetValue, isUnsetValue())

Modified: trunk/Source/WebCore/css/CSSValue.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/CSSValue.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSValue.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -49,8 +49,6 @@
 #include "CSSGradientValue.h"
 #include "CSSImageSetValue.h"
 #include "CSSImageValue.h"
-#include "CSSInheritedValue.h"
-#include "CSSInitialValue.h"
 #include "CSSLineBoxContainValue.h"
 #include "CSSNamedImageValue.h"
 #include "CSSPaintImageValue.h"
@@ -61,7 +59,6 @@
 #include "CSSShadowValue.h"
 #include "CSSTimingFunctionValue.h"
 #include "CSSUnicodeRangeValue.h"
-#include "CSSUnsetValue.h"
 #include "CSSValueList.h"
 #include "CSSValuePair.h"
 #include "CSSVariableReferenceValue.h"
@@ -83,16 +80,11 @@
 
 COMPILE_ASSERT(sizeof(CSSValue) == sizeof(SameSizeAsCSSValue), CSS_value_should_stay_small);
 
-bool CSSValue::isImplicitInitialValue() const
-{
-    return m_classType == InitialClass && downcast<CSSInitialValue>(*this).isImplicit();
-}
-
 DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(CSSValue);
 
 CSSValue::Type CSSValue::cssValueType() const
 {
-    if (isInheritedValue())
+    if (isInheritValue())
         return CSS_INHERIT;
     if (isPrimitiveValue())
         return CSS_PRIMITIVE_VALUE;
@@ -184,14 +176,6 @@
             return compareCSSValues<CSSCrossfadeValue>(*this, other);
         case ImageClass:
             return compareCSSValues<CSSImageValue>(*this, other);
-        case InheritedClass:
-            return compareCSSValues<CSSInheritedValue>(*this, other);
-        case InitialClass:
-            return compareCSSValues<CSSInitialValue>(*this, other);
-        case UnsetClass:
-            return compareCSSValues<CSSUnsetValue>(*this, other);
-        case RevertClass:
-            return compareCSSValues<CSSRevertValue>(*this, other);
         case GridAutoRepeatClass:
             return compareCSSValues<CSSGridAutoRepeatValue>(*this, other);
         case GridIntegerRepeatClass:
@@ -286,14 +270,6 @@
         return downcast<CSSCrossfadeValue>(*this).customCSSText();
     case ImageClass:
         return downcast<CSSImageValue>(*this).customCSSText();
-    case InheritedClass:
-        return downcast<CSSInheritedValue>(*this).customCSSText();
-    case InitialClass:
-        return downcast<CSSInitialValue>(*this).customCSSText();
-    case UnsetClass:
-        return downcast<CSSUnsetValue>(*this).customCSSText();
-    case RevertClass:
-        return downcast<CSSRevertValue>(*this).customCSSText();
     case GridAutoRepeatClass:
         return downcast<CSSGridAutoRepeatValue>(*this).customCSSText();
     case GridIntegerRepeatClass:
@@ -410,18 +386,6 @@
     case ImageClass:
         delete downcast<CSSImageValue>(this);
         return;
-    case InheritedClass:
-        delete downcast<CSSInheritedValue>(this);
-        return;
-    case InitialClass:
-        delete downcast<CSSInitialValue>(this);
-        return;
-    case UnsetClass:
-        delete downcast<CSSUnsetValue>(this);
-        return;
-    case RevertClass:
-        delete downcast<CSSRevertValue>(this);
-        return;
     case GridAutoRepeatClass:
         delete downcast<CSSGridAutoRepeatValue>(this);
         return;
@@ -513,12 +477,43 @@
 
 bool CSSValue::treatAsInheritedValue(CSSPropertyID propertyID) const
 {
-    return classType() == InheritedClass || (classType() == UnsetClass && CSSProperty::isInheritedProperty(propertyID));
+    return isInheritValue() || (isUnsetValue() && CSSProperty::isInheritedProperty(propertyID));
 }
 
 bool CSSValue::treatAsInitialValue(CSSPropertyID propertyID) const
 {
-    return classType() == InitialClass || (classType() == UnsetClass && !CSSProperty::isInheritedProperty(propertyID));
+    return isInitialValue() || (isUnsetValue() && !CSSProperty::isInheritedProperty(propertyID));
 }
 
+bool CSSValue::isInitialValue() const
+{
+    return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isInitialValue();
 }
+
+bool CSSValue::isImplicitInitialValue() const
+{
+    return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isImplicitInitialValue();
+}
+
+bool CSSValue::isInheritValue() const
+{
+    return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isInheritValue();
+}
+
+bool CSSValue::isUnsetValue() const
+{
+    return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isUnsetValue();
+}
+
+bool CSSValue::isRevertValue() const
+{
+    return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isRevertValue();
+}
+
+bool CSSValue::isCSSWideKeyword() const
+{
+    return is<CSSPrimitiveValue>(*this) && downcast<CSSPrimitiveValue>(*this).isCSSWideKeyword();
+}
+
+
+}

Modified: trunk/Source/WebCore/css/CSSValue.h (285372 => 285373)


--- trunk/Source/WebCore/css/CSSValue.h	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSValue.h	2021-11-06 19:20:59 UTC (rev 285373)
@@ -107,11 +107,11 @@
     bool isImageSetValue() const { return m_classType == ImageSetClass; }
     bool isImageValue() const { return m_classType == ImageClass; }
     bool isImplicitInitialValue() const;
-    bool isInheritedValue() const { return m_classType == InheritedClass; }
-    bool isInitialValue() const { return m_classType == InitialClass; }
-    bool isUnsetValue() const { return m_classType == UnsetClass; }
-    bool isRevertValue() const { return m_classType == RevertClass; }
-    bool isGlobalKeyword() const { return isInheritedValue() || isInitialValue() || isUnsetValue() || isRevertValue(); }
+    bool isInheritValue() const;
+    bool isInitialValue() const;
+    bool isUnsetValue() const;
+    bool isRevertValue() const;
+    bool isCSSWideKeyword() const;
     bool treatAsInitialValue(CSSPropertyID) const;
     bool treatAsInheritedValue(CSSPropertyID) const;
     bool isLinearGradientValue() const { return m_classType == LinearGradientClass; }
@@ -191,11 +191,6 @@
         FontPaletteValuesOverrideColorsClass,
         FunctionClass,
 
-        InheritedClass,
-        InitialClass,
-        UnsetClass,
-        RevertClass,
-
         ReflectClass,
         ShadowClass,
         UnicodeRangeClass,
@@ -237,6 +232,7 @@
         : m_primitiveUnitType(0)
         , m_hasCachedCSSText(false)
         , m_valueSeparator(SpaceSeparator)
+        , m_isImplicit(false)
         , m_classType(classType)
     {
     }
@@ -263,6 +259,7 @@
     mutable unsigned m_hasCachedCSSText : 1;
 
     unsigned m_valueSeparator : ValueSeparatorBits;
+    unsigned m_isImplicit : 1;
 
 private:
     unsigned m_classType : ClassTypeBits; // ClassType

Modified: trunk/Source/WebCore/css/CSSValuePool.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/CSSValuePool.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSValuePool.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -38,12 +38,8 @@
 
 StaticCSSValuePool::StaticCSSValuePool()
 {
-    m_inheritedValue.construct(CSSValue::StaticCSSValue);
-    m_implicitInitialValue.construct(CSSValue::StaticCSSValue, true);
-    m_explicitInitialValue.construct(CSSValue::StaticCSSValue, false);
-    m_unsetValue.construct(CSSValue::StaticCSSValue);
-    m_revertValue.construct(CSSValue::StaticCSSValue);
-
+    m_implicitInitialValue.construct(CSSValue::StaticCSSValue, CSSPrimitiveValue::ImplicitInitialValue);
+    
     m_transparentColor.construct(CSSValue::StaticCSSValue, Color::transparentBlack);
     m_whiteColor.construct(CSSValue::StaticCSSValue, Color::white);
     m_blackColor.construct(CSSValue::StaticCSSValue, Color::black);

Modified: trunk/Source/WebCore/css/CSSValuePool.h (285372 => 285373)


--- trunk/Source/WebCore/css/CSSValuePool.h	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/CSSValuePool.h	2021-11-06 19:20:59 UTC (rev 285373)
@@ -25,12 +25,8 @@
 
 #pragma once
 
-#include "CSSInheritedValue.h"
-#include "CSSInitialValue.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSPropertyNames.h"
-#include "CSSRevertValue.h"
-#include "CSSUnsetValue.h"
 #include "CSSValueKeywords.h"
 #include "ColorHash.h"
 #include <utility>
@@ -55,11 +51,7 @@
 private:
     StaticCSSValuePool();
 
-    LazyNeverDestroyed<CSSInheritedValue> m_inheritedValue;
-    LazyNeverDestroyed<CSSInitialValue> m_implicitInitialValue;
-    LazyNeverDestroyed<CSSInitialValue> m_explicitInitialValue;
-    LazyNeverDestroyed<CSSUnsetValue> m_unsetValue;
-    LazyNeverDestroyed<CSSRevertValue> m_revertValue;
+    LazyNeverDestroyed<CSSPrimitiveValue> m_implicitInitialValue;
 
     LazyNeverDestroyed<CSSPrimitiveValue> m_transparentColor;
     LazyNeverDestroyed<CSSPrimitiveValue> m_whiteColor;
@@ -85,11 +77,7 @@
 
     RefPtr<CSSValueList> createFontFaceValue(const AtomString&);
     Ref<CSSPrimitiveValue> createFontFamilyValue(const String&, FromSystemFontID = FromSystemFontID::No);
-    Ref<CSSInheritedValue> createInheritedValue() { return staticCSSValuePool->m_inheritedValue.get(); }
-    Ref<CSSInitialValue> createImplicitInitialValue() { return staticCSSValuePool->m_implicitInitialValue.get(); }
-    Ref<CSSInitialValue> createExplicitInitialValue() { return staticCSSValuePool->m_explicitInitialValue.get(); }
-    Ref<CSSUnsetValue> createUnsetValue() { return staticCSSValuePool->m_unsetValue.get(); }
-    Ref<CSSRevertValue> createRevertValue() { return staticCSSValuePool->m_revertValue.get(); }
+    Ref<CSSPrimitiveValue> createImplicitInitialValue() { return staticCSSValuePool->m_implicitInitialValue.get(); }
     Ref<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier);
     Ref<CSSPrimitiveValue> createIdentifierValue(CSSPropertyID identifier);
     Ref<CSSPrimitiveValue> createColorValue(const Color&);

Modified: trunk/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.h (285372 => 285373)


--- trunk/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.h	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.h	2021-11-06 19:20:59 UTC (rev 285373)
@@ -89,6 +89,8 @@
     static ExceptionOr<void> setStringValue(unsigned short, const String&) { return Exception { NoModificationAllowedError }; }
 
     String stringValue() const { return m_value->stringValue(); }
+    bool isCSSWideKeyword() const { return m_value->isCSSWideKeyword(); }
+    unsigned cssValueType() const { return m_value->cssValueType(); }
 
 private:
     DeprecatedCSSOMPrimitiveValue(const CSSPrimitiveValue& value, CSSStyleDeclaration& owner)

Modified: trunk/Source/WebCore/css/DeprecatedCSSOMValue.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/DeprecatedCSSOMValue.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/DeprecatedCSSOMValue.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -57,7 +57,7 @@
     case DeprecatedComplexValueClass:
         return downcast<DeprecatedCSSOMComplexValue>(*this).cssValueType();
     case DeprecatedPrimitiveValueClass:
-        return CSS_PRIMITIVE_VALUE;
+        return downcast<DeprecatedCSSOMPrimitiveValue>(*this).cssValueType();
     case DeprecatedValueListClass:
         return CSS_VALUE_LIST;
     }

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -45,6 +45,7 @@
 #include "RenderElement.h"
 #include "SelectorCheckerTestFunctions.h"
 #include "ShadowRoot.h"
+#include "StyleScope.h"
 #include "Text.h"
 #include "TypedElementDescendantIterator.h"
 

Modified: trunk/Source/WebCore/css/StyleProperties.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/StyleProperties.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/StyleProperties.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -400,7 +400,7 @@
     if (topLeft.isImportant() != topRight.isImportant() || topRight.isImportant() != bottomRight.isImportant() || bottomRight.isImportant() != bottomLeft.isImportant())
         return String();
 
-    if (topLeftValue->isInheritedValue() && topRightValue->isInheritedValue() && bottomRightValue->isInheritedValue() && bottomLeftValue->isInheritedValue())
+    if (topLeftValue->isInheritValue() && topRightValue->isInheritValue() && bottomRightValue->isInheritValue() && bottomLeftValue->isInheritValue())
         return getValueName(CSSValueInherit);
 
     if (topLeftValue->isInitialValue() || topRightValue->isInitialValue() || bottomRightValue->isInitialValue() || bottomLeftValue->isInitialValue()) {
@@ -852,8 +852,8 @@
     auto value = getPropertyCSSValue(shorthand.properties()[0]);
     if (!value)
         return String();
-    // FIXME: Remove this isGlobalKeyword check after we do this consistently for all shorthands in getPropertyValue.
-    if (value->isGlobalKeyword())
+    // FIXME: Remove this isCSSWideKeyword check after we do this consistently for all shorthands in getPropertyValue.
+    if (value->isCSSWideKeyword())
         return value->cssText();
     
     if (!is<CSSPrimitiveValue>(*value))

Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -1115,19 +1115,11 @@
     if (!valueID)
         return nullptr;
 
-    if (!parsingDescriptor) {
-        if (valueID == CSSValueInherit)
-            return CSSValuePool::singleton().createInheritedValue();
-        if (valueID == CSSValueInitial)
-            return CSSValuePool::singleton().createExplicitInitialValue();
-        if (valueID == CSSValueUnset)
-            return CSSValuePool::singleton().createUnsetValue();
-        if (valueID == CSSValueRevert)
-            return CSSValuePool::singleton().createRevertValue();
-    }
-    
+    if (!parsingDescriptor && isCSSWideKeyword(valueID))
+        return CSSValuePool::singleton().createIdentifierValue(valueID);
+
     if (CSSParserFastPaths::isValidKeywordPropertyAndValue(propertyId, valueID, context))
-        return CSSPrimitiveValue::createIdentifier(valueID);
+        return CSSValuePool::singleton().createIdentifierValue(valueID);
     return nullptr;
 }
 

Modified: trunk/Source/WebCore/css/parser/CSSParserIdioms.h (285372 => 285373)


--- trunk/Source/WebCore/css/parser/CSSParserIdioms.h	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/parser/CSSParserIdioms.h	2021-11-06 19:20:59 UTC (rev 285373)
@@ -59,4 +59,15 @@
 
 bool isValueAllowedInMode(unsigned short, CSSParserMode);
 
+static inline bool isCSSWideKeyword(CSSValueID valueID)
+{
+    return valueID == CSSValueInitial || valueID == CSSValueInherit || valueID == CSSValueUnset || valueID == CSSValueRevert;
+}
+
+static inline bool isValidCustomIdentifier(CSSValueID valueID)
+{
+    // "default" is obsolete as a CSS-wide keyword but is still not allowed as a custom identifier.
+    return !isCSSWideKeyword(valueID) && valueID != CSSValueDefault;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -258,20 +258,11 @@
     if (!rangeCopy.atEnd())
         return nullptr;
 
-    RefPtr<CSSValue> value;
-    if (valueID == CSSValueInherit)
-        value = CSSValuePool::singleton().createInheritedValue();
-    else if (valueID == CSSValueInitial)
-        value = CSSValuePool::singleton().createExplicitInitialValue();
-    else if (valueID == CSSValueUnset)
-        value = CSSValuePool::singleton().createUnsetValue();
-    else if (valueID == CSSValueRevert)
-        value = CSSValuePool::singleton().createRevertValue();
-    else
+    if (!isCSSWideKeyword(valueID))
         return nullptr;
 
     range = rangeCopy;
-    return value;
+    return CSSValuePool::singleton().createIdentifierValue(valueID);
 }
 
 RefPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID property, const CSSParserTokenRange& range, const CSSParserContext& context)

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (285372 => 285373)


--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -59,11 +59,6 @@
 
 namespace CSSPropertyParserHelpers {
 
-static inline bool isCSSWideKeyword(CSSValueID id)
-{
-    return id == CSSValueInitial || id == CSSValueInherit || id == CSSValueUnset || id == CSSValueRevert || id == CSSValueDefault;
-}
-
 bool consumeCommaIncludingWhitespace(CSSParserTokenRange& range)
 {
     CSSParserToken value = range.peek();
@@ -1370,7 +1365,7 @@
 
 RefPtr<CSSPrimitiveValue> consumeCustomIdent(CSSParserTokenRange& range, bool shouldLowercase)
 {
-    if (range.peek().type() != IdentToken || isCSSWideKeyword(range.peek().id()))
+    if (range.peek().type() != IdentToken || !isValidCustomIdentifier(range.peek().id()))
         return nullptr;
     auto identifier = range.consumeIncludingWhitespace().value();
     return CSSValuePool::singleton().createCustomIdent(shouldLowercase ? identifier.convertToASCIILowercase() : identifier.toString());
@@ -3648,7 +3643,7 @@
     if (!prelude.atEnd())
         return AtomString();
     // Ensure this token is a valid <custom-ident>.
-    if (nameToken.type() != IdentToken || isCSSWideKeyword(nameToken.id()))
+    if (nameToken.type() != IdentToken || !isValidCustomIdentifier(nameToken.id()))
         return AtomString();
     // In the context of the prelude of an @counter-style rule, a <counter-style-name> must not be an ASCII
     // case-insensitive match for "decimal" or "disc". No <counter-style-name>, prelude or not, may be an ASCII
@@ -3725,7 +3720,7 @@
         }
         builder.append(range.consumeIncludingWhitespace().value());
     }
-    if (!addedSpace && isCSSWideKeyword(firstToken.id()))
+    if (!addedSpace && !isValidCustomIdentifier(firstToken.id()))
         return String();
     return builder.toString();
 }

Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (285372 => 285373)


--- trunk/Source/WebCore/editing/EditingStyle.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -266,6 +266,9 @@
         return false;
 
     auto& primitiveValue = downcast<CSSPrimitiveValue>(fontWeight);
+    if (primitiveValue.isCSSWideKeyword())
+        return false;
+
     switch (primitiveValue.valueID()) {
     case CSSValueNormal:
         return false;

Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm (285372 => 285373)


--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm	2021-11-06 19:20:59 UTC (rev 285373)
@@ -587,7 +587,7 @@
 
     if (RefPtr<CSSValue> value = inlineStylePropertyForElement(element, propertyId)) {
         String result;
-        if (value->isInheritedValue())
+        if (value->isInheritValue())
             inherit = true;
         else if (stringFromCSSValue(*value, result))
             return result;
@@ -735,7 +735,7 @@
     if (RefPtr<CSSValue> value = inlineStylePropertyForElement(element, propertyId)) {
         if (is<CSSPrimitiveValue>(*value) && floatValueFromPrimitiveValue(downcast<CSSPrimitiveValue>(*value), result))
             return true;
-        if (value->isInheritedValue())
+        if (value->isInheritValue())
             inherit = true;
     }
 
@@ -877,7 +877,7 @@
     if (RefPtr<CSSValue> value = inlineStylePropertyForElement(element, propertyId)) {
         if (is<CSSPrimitiveValue>(*value) && downcast<CSSPrimitiveValue>(*value).isRGBColor())
             return normalizedColor(downcast<CSSPrimitiveValue>(*value).color(), ignoreDefaultColor, element);
-        if (value->isInheritedValue())
+        if (value->isInheritValue())
             inherit = true;
     }
 

Modified: trunk/Source/WebCore/html/HTMLTableElement.cpp (285372 => 285373)


--- trunk/Source/WebCore/html/HTMLTableElement.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/html/HTMLTableElement.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -484,7 +484,7 @@
         style->setProperty(CSSPropertyBorderRightWidth, CSSValueThin);
         style->setProperty(CSSPropertyBorderLeftStyle, CSSValueSolid);
         style->setProperty(CSSPropertyBorderRightStyle, CSSValueSolid);
-        style->setProperty(CSSPropertyBorderColor, cssValuePool.createInheritedValue());
+        style->setProperty(CSSPropertyBorderColor, cssValuePool.createIdentifierValue(CSSValueInherit));
         break;
     case SolidBordersRowsOnly:
         style->setProperty(CSSPropertyBorderTopWidth, CSSValueThin);
@@ -491,17 +491,17 @@
         style->setProperty(CSSPropertyBorderBottomWidth, CSSValueThin);
         style->setProperty(CSSPropertyBorderTopStyle, CSSValueSolid);
         style->setProperty(CSSPropertyBorderBottomStyle, CSSValueSolid);
-        style->setProperty(CSSPropertyBorderColor, cssValuePool.createInheritedValue());
+        style->setProperty(CSSPropertyBorderColor, cssValuePool.createIdentifierValue(CSSValueInherit));
         break;
     case SolidBorders:
         style->setProperty(CSSPropertyBorderWidth, cssValuePool.createValue(1, CSSUnitType::CSS_PX));
         style->setProperty(CSSPropertyBorderStyle, cssValuePool.createIdentifierValue(CSSValueSolid));
-        style->setProperty(CSSPropertyBorderColor, cssValuePool.createInheritedValue());
+        style->setProperty(CSSPropertyBorderColor, cssValuePool.createIdentifierValue(CSSValueInherit));
         break;
     case InsetBorders:
         style->setProperty(CSSPropertyBorderWidth, cssValuePool.createValue(1, CSSUnitType::CSS_PX));
         style->setProperty(CSSPropertyBorderStyle, cssValuePool.createIdentifierValue(CSSValueInset));
-        style->setProperty(CSSPropertyBorderColor, cssValuePool.createInheritedValue());
+        style->setProperty(CSSPropertyBorderColor, cssValuePool.createIdentifierValue(CSSValueInherit));
         break;
     case NoBorders:
         // If 'rules=none' then allow any borders set at cell level to take effect. 

Modified: trunk/Source/WebCore/style/ElementRuleCollector.cpp (285372 => 285373)


--- trunk/Source/WebCore/style/ElementRuleCollector.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/style/ElementRuleCollector.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -602,7 +602,7 @@
             // as they might override the value inherited here. For this reason we don't allow declarations with
             // explicitly inherited properties to be cached.
             const CSSValue& value = *current.value();
-            if (value.isInheritedValue())
+            if (value.isInheritValue())
                 return false;
 
             // The value currentColor has implicitely the same side effect. It depends on the value of color,

Modified: trunk/Source/WebCore/style/PropertyCascade.cpp (285372 => 285373)


--- trunk/Source/WebCore/style/PropertyCascade.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/style/PropertyCascade.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -185,7 +185,7 @@
         if (m_includedProperties == IncludedProperties::InheritedOnly && !current.isInherited()) {
             // Inherited only mode is used after matched properties cache hit.
             // A match with a value that is explicitly inherited should never have been cached.
-            ASSERT(!current.value()->isInheritedValue());
+            ASSERT(!current.value()->isInheritValue());
             continue;
         }
         CSSPropertyID propertyID = current.id();
@@ -308,7 +308,7 @@
         for (const auto& matchedProperties : declarationsForCascadeLevel(m_matchResult, cascadeLevel)) {
             for (unsigned i = 0, count = matchedProperties.properties->propertyCount(); i < count; ++i) {
                 auto property = matchedProperties.properties->propertyAt(i);
-                if (!property.value()->isPrimitiveValue())
+                if (!property.value()->isPrimitiveValue() || property.value()->isCSSWideKeyword())
                     continue;
                 switch (property.id()) {
                 case CSSPropertyWritingMode:

Modified: trunk/Source/WebCore/style/StyleBuilder.cpp (285372 => 285373)


--- trunk/Source/WebCore/style/StyleBuilder.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/style/StyleBuilder.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -290,7 +290,7 @@
         customPropertyRegistered = m_state.document().getCSSRegisteredCustomPropertySet().get(name);
     }
 
-    bool isInherit = valueToApply->isInheritedValue() || customPropertyValueID == CSSValueInherit;
+    bool isInherit = valueToApply->isInheritValue() || customPropertyValueID == CSSValueInherit;
     bool isInitial = valueToApply->isInitialValue() || customPropertyValueID == CSSValueInitial;
 
     bool isUnset = valueToApply->isUnsetValue() || customPropertyValueID == CSSValueUnset;
@@ -361,8 +361,8 @@
     // If the cascade has already applied this id, then we detected a cycle, and this value should be unset.
     if (!variableValue || m_state.m_appliedProperties.get(propertyID)) {
         if (CSSProperty::isInheritedProperty(propertyID))
-            return CSSValuePool::singleton().createInheritedValue();
-        return CSSValuePool::singleton().createExplicitInitialValue();
+            return CSSValuePool::singleton().createValue(CSSValueInherit);
+        return CSSValuePool::singleton().createValue(CSSValueInitial);
     }
 
     return *variableValue;

Modified: trunk/Source/WebCore/svg/SVGFontFaceElement.cpp (285372 => 285373)


--- trunk/Source/WebCore/svg/SVGFontFaceElement.cpp	2021-11-06 18:35:06 UTC (rev 285372)
+++ trunk/Source/WebCore/svg/SVGFontFaceElement.cpp	2021-11-06 19:20:59 UTC (rev 285373)
@@ -84,7 +84,7 @@
             // Rather than invasively modifying the parser for the properties to have a special mode, we can simply detect the error condition after-the-fact and
             // avoid it explicitly.
             if (auto parsedValue = properties.getPropertyCSSValue(propertyId)) {
-                if (parsedValue->isGlobalKeyword())
+                if (parsedValue->isCSSWideKeyword())
                     properties.removeProperty(propertyId);
             }
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to