Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: b96c4a014f188f11c6fdfbb91937d42466fae41e https://github.com/WebKit/WebKit/commit/b96c4a014f188f11c6fdfbb91937d42466fae41e Author: Vitor Roriz <vitor.ro...@apple.com> Date: 2023-03-31 (Fri, 31 Mar 2023)
Changed paths: M LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/prefix-suffix-syntax-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/speak-as-syntax-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/symbols-syntax-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt M Source/WebCore/css/CSSCounterStyle.cpp M Source/WebCore/css/CSSCounterStyle.h M Source/WebCore/css/CSSCounterStyleDescriptors.cpp M Source/WebCore/css/CSSCounterStyleDescriptors.h M Source/WebCore/css/CSSCounterStyleRule.cpp M Source/WebCore/css/CSSCounterStyleRule.h M Source/WebCore/css/parser/CSSParserImpl.cpp M Source/WebCore/rendering/RenderListMarker.cpp Log Message: ----------- Refactor StyleRuleCounterStyle for eliminating StyleProperties https://bugs.webkit.org/show_bug.cgi?id=254524 rdar://107267784 Reviewed by Antti Koivisto. StyleRuleCounterStyle currently stores `StyleProperties` besides `CSSCounterStyleDescriptors`. This is used for facilitating serialization and read/write for the CSSOM api. We can get rid of the `StyleProperties` member and use only `CSSCounterStyleDescriptors` after we write a serializer for each descriptor and adapt the setter function for setting only the `CSSCounterStyleDescriptors` without havint to set the property that originated the descriptor. * LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/prefix-suffix-syntax-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/speak-as-syntax-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/symbols-syntax-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-speak-as-syntax-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt: - We and other browsers don't support url() as symbol for the counter-style at-rule, so these should be failing. They were suceeding, because we parsed it correctly, but since we don't support it, we shouldn't be able to use this value for setting the descriptor. - We don't support the speak-as descriptor, it should be failing. - Note that these tests are duplicated. We should re-import WPT and get rid of the dupes (rdar://107410996) * Source/WebCore/css/CSSCounterStyle.cpp: (WebCore::CSSCounterStyle::counterForSystemCyclic const): (WebCore::CSSCounterStyle::counterForSystemFixed const): (WebCore::CSSCounterStyle::counterForSystemSymbolic const): (WebCore::CSSCounterStyle::counterForSystemAlphabetic const): (WebCore::CSSCounterStyle::counterForSystemNumeric const): (WebCore::CSSCounterStyle::counterForSystemAdditive const): (WebCore::CSSCounterStyle::applyNegativeSymbols const): (WebCore::CSSCounterStyle::applyPadSymbols const): (WebCore::CSSCounterStyle::extendAndResolve): - Since now Symbols is a struct, to support correct serialization of custom-ident and string values, we should access the text value with the .text member. * Source/WebCore/css/CSSCounterStyle.h: (WebCore::CSSCounterStyle::isExtendsUnresolved): - Moving this flag to the descriptor so we can use it for serialization of the system. * Source/WebCore/css/CSSCounterStyleDescriptors.cpp: - We are renaming the translating functions, removing the 'translate' prefix to become in better compliance with WebKit style. - The translation functions are now exposed via the header because when a descriptor is set via CSSOM, we need to translate its CSSValue to the descriptor value. - Each descriptor has now a setter method, which will also take care of its validation. Before, the validation would happen through setterInternal() and newValueInvalidOrEqual() methods: (WebCore::rangeFromStyleProperties): (WebCore::rangeFromCSSValue): (WebCore::symbolFromCSSValue): (WebCore::nameFromCSSValue): (WebCore::additiveSymbolsFromStyleProperties): (WebCore::additiveSymbolsFromCSSValue): (WebCore::padFromStyleProperties): (WebCore::padFromCSSValue): (WebCore::negativeSymbolsFromStyleProperties): (WebCore::negativeSymbolsFromCSSValue): (WebCore::symbolsFromStyleProperties): (WebCore::symbolsFromCSSValue): (WebCore::fallbackNameFromStyleProperties): (WebCore::fallbackNameFromCSSValue): (WebCore::prefixFromStyleProperties): (WebCore::suffixFromStyleProperties): (WebCore::extractSystemDataFromStyleProperties): (WebCore::extractSystemDataFromCSSValue): (WebCore::CSSCounterStyleDescriptors::setExplicitlySetDescriptors): (WebCore::CSSCounterStyleDescriptors::create): (WebCore::CSSCounterStyleDescriptors::areSymbolsValidForSystem): (WebCore::CSSCounterStyleDescriptors::isValid const): (WebCore::CSSCounterStyleDescriptors::setName): (WebCore::CSSCounterStyleDescriptors::setSystemData): (WebCore::CSSCounterStyleDescriptors::setNegative): (WebCore::CSSCounterStyleDescriptors::setPrefix): (WebCore::CSSCounterStyleDescriptors::setSuffix): (WebCore::CSSCounterStyleDescriptors::setRanges): (WebCore::CSSCounterStyleDescriptors::setPad): (WebCore::CSSCounterStyleDescriptors::setFallbackName): (WebCore::CSSCounterStyleDescriptors::setSymbols): (WebCore::CSSCounterStyleDescriptors::setAdditiveSymbols): (WebCore::CSSCounterStyleDescriptors::Symbol::cssText const): (WebCore::CSSCounterStyleDescriptors::nameCSSText const): (WebCore::CSSCounterStyleDescriptors::systemCSSText const): (WebCore::CSSCounterStyleDescriptors::negativeCSSText const): (WebCore::CSSCounterStyleDescriptors::prefixCSSText const): (WebCore::CSSCounterStyleDescriptors::suffixCSSText const): (WebCore::CSSCounterStyleDescriptors::rangesCSSText const): (WebCore::CSSCounterStyleDescriptors::Pad::cssText const): (WebCore::CSSCounterStyleDescriptors::padCSSText const): (WebCore::CSSCounterStyleDescriptors::fallbackCSSText const): (WebCore::CSSCounterStyleDescriptors::symbolsCSSText const): (WebCore::CSSCounterStyleDescriptors::additiveSymbolsCSSText const): (WebCore::translateRangeFromStyleProperties): Deleted. (WebCore::symbolToString): Deleted. (WebCore::translateAdditiveSymbolsFromStyleProperties): Deleted. (WebCore::translatePadFromStyleProperties): Deleted. (WebCore::translateNegativeSymbolsFromStyleProperties): Deleted. (WebCore::translateSymbolsFromStyleProperties): Deleted. (WebCore::translateFallbackNameFromStyleProperties): Deleted. (WebCore::translatePrefixFromStyleProperties): Deleted. (WebCore::translateSuffixFromStyleProperties): Deleted. (WebCore::extractDataFromSystemDescriptor): Deleted. (WebCore::CSSCounterStyleDescriptors::areSymbolsValidForSystem const): Deleted. * Source/WebCore/css/CSSCounterStyleDescriptors.h: (WebCore::CSSCounterStyleDescriptors::Symbol::operator== const): (WebCore::CSSCounterStyleDescriptors::Symbol::operator!= const): (WebCore::CSSCounterStyleDescriptors::setName): Deleted. * Source/WebCore/css/CSSCounterStyleRule.cpp: (WebCore::StyleRuleCounterStyle::StyleRuleCounterStyle): (WebCore::StyleRuleCounterStyle::create): - We no longer need to store the StyleProperties used for creating the CSSCounterStyleDescriptors inside StyleRuleCounterStyle. Now we store only CSSCounterStyleDescriptors. (WebCore::CSSCounterStyleRule::CSSValueFromText): (WebCore::CSSCounterStyleRule::setName): (WebCore::CSSCounterStyleRule::setSystem): (WebCore::CSSCounterStyleRule::setNegative): (WebCore::CSSCounterStyleRule::setPrefix): (WebCore::CSSCounterStyleRule::setSuffix): (WebCore::CSSCounterStyleRule::setRange): (WebCore::CSSCounterStyleRule::setPad): (WebCore::CSSCounterStyleRule::setFallback): (WebCore::CSSCounterStyleRule::setSymbols): (WebCore::CSSCounterStyleRule::setAdditiveSymbols): (WebCore::CSSCounterStyleRule::setSpeakAs): (WebCore::symbolsValidForSystem): Deleted. (WebCore::StyleRuleCounterStyle::newValueInvalidOrEqual const): Deleted. (WebCore::StyleRuleCounterStyle::mutableProperties): Deleted. (WebCore::CSSCounterStyleRule::setterInternal): Deleted. - The CSSCounterStyleRule setters now use the setters of CSSCounterStyleDescriptors to set each descriptor directly, without having validating it with setterInternal() and newValueInvalidOrEqual(), since each setter validates itself. * Source/WebCore/css/CSSCounterStyleRule.h: * Source/WebCore/css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumeCounterStyleRule): * Source/WebCore/rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::updateContent): - Updating the access of symbol's via .text member, since it is now a struct for supporting serialization (see first comments). Canonical link: https://commits.webkit.org/262396@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes