Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 853c4e577730e9028620990bd328d13713b6f8ed https://github.com/WebKit/WebKit/commit/853c4e577730e9028620990bd328d13713b6f8ed Author: Vitor Roriz <vitor.ro...@apple.com> Date: 2023-02-28 (Tue, 28 Feb 2023)
Changed paths: M LayoutTests/webexposed/counter-style-image-symbols-not-exposed-expected.txt M Source/WebCore/css/CSSCounterStyleDescriptors.cpp M Source/WebCore/css/CSSCounterStyleDescriptors.h M Source/WebCore/css/CSSCounterStyleRegistry.cpp M Source/WebCore/css/CSSCounterStyleRegistry.h M Source/WebCore/css/CSSCounterStyleRule.cpp M Source/WebCore/css/CSSCounterStyleRule.h M Source/WebCore/css/parser/CSSParserImpl.cpp M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp M Source/WebCore/css/parser/CSSPropertyParserHelpers.h M Source/WebCore/style/UserAgentStyle.cpp Log Message: ----------- References resolution for UA counter-styles https://bugs.webkit.org/show_bug.cgi?id=252899 rdar://103021161 Reviewed by Tim Nguyen. We need to resolve references for the predefined counter-styles which rules are stored in UA stylesheet. These references can be resolved after the counter-style UA stylesheet is parsed and before resolving references of the author counter styles. * Source/WebCore/css/CSSCounterStyleDescriptors.cpp: (WebCore::translateSuffixFromStyleProperties): (WebCore::extractDataFromSystemDescriptor): - Small adjustments in the default values for the descriptors. (WebCore::CSSCounterStyleDescriptors::areSymbolsValidForSystem const): (WebCore::CSSCounterStyleDescriptors::isValid const): - Adding functions for validating a descriptor. For now, we only validate the symbols according to the counter-style system, as described in the spec. * Source/WebCore/css/CSSCounterStyleDescriptors.h: * Source/WebCore/css/CSSCounterStyleRegistry.cpp: (WebCore::CSSCounterStyleRegistry::resolveUserAgentReferences): (WebCore::CSSCounterStyleRegistry::resolveReferencesIfNeeded): (WebCore::CSSCounterStyleRegistry::resolveExtendsReference): (WebCore::CSSCounterStyleRegistry::resolveFallbackReference): (WebCore::CSSCounterStyleRegistry::counterStyle): (WebCore::CSSCounterStyleRegistry::resolvedCounterStyle): - Since the counter-styles map (userAgentCounterStyles()) lives in static memory, I'm modifying the resolution functions from the CSSCounterStyleRegistry for being static and receiving a map instead, so they can serve for both the UA and author counter styles. CSSCounterStyleRegistry::resolveUserAgentReferences() is the wrapper for when we are resolving references for the UA counter-styles. * Source/WebCore/css/CSSCounterStyleRegistry.h: * Source/WebCore/css/CSSCounterStyleRule.cpp: (WebCore::StyleRuleCounterStyle::create): * Source/WebCore/css/CSSCounterStyleRule.h: * Source/WebCore/css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumeCounterStyleRule): - Calling the new validation function for the descriptor before trying to cerate a StyleRuleCounterStyles. * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude): - The spec says that certain names, reserved for predefined counter-styles, should not be accepted as a valid name during parser and if matched should invalidate the rule. This is already done, but since we want to re-use the same parsing functions for both author and UA rules we need a small tweak: We are now passing the CSSParserMode to consumeCounterStyleNameInPrelude() and allowing these reserved names when we are in UA mode. * Source/WebCore/css/parser/CSSPropertyParserHelpers.h: * Source/WebCore/style/UserAgentStyle.cpp: (WebCore::Style::addToCounterStyleRegistry): - Resolving UA counter-styles references after all counter-styles are collected from the UA stylesheet to the UA counter-styles map. * LayoutTests/webexposed/counter-style-image-symbols-not-exposed-expected.txt: - Rebaselining. Although we parse images as symbols, we don't support it in counter-style so the descriptor is invalidated. Canonical link: https://commits.webkit.org/260940@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes