[webkit-changes] [WebKit/WebKit] 316bd0: Implementing CounterStyleRegistry for reference re...
Vitor Roriz
noreply at github.com
Thu Jan 5 13:57:05 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 316bd081ae8deaba9d8933e555c173593b3a1600
https://github.com/WebKit/WebKit/commit/316bd081ae8deaba9d8933e555c173593b3a1600
Author: Vitor Roriz <vitor.roriz at apple.com>
Date: 2023-01-05 (Thu, 05 Jan 2023)
Changed paths:
M Source/WebCore/Headers.cmake
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/css/CSSCounterStyle.cpp
M Source/WebCore/css/CSSCounterStyle.h
M Source/WebCore/css/CSSCounterStyleDescriptors.h
A Source/WebCore/css/CSSCounterStyleRegistry.cpp
A Source/WebCore/css/CSSCounterStyleRegistry.h
M Source/WebCore/css/CSSCounterStyleRule.cpp
M Source/WebCore/css/CSSCounterStyleRule.h
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/rendering/RenderListMarker.cpp
M Source/WebCore/rendering/RenderListMarker.h
M Source/WebCore/rendering/style/RenderStyle.h
M Source/WebCore/rendering/style/RenderStyleConstants.h
M Source/WebCore/style/RuleSetBuilder.cpp
M Source/WebCore/style/StyleBuilderCustom.h
M Source/WebCore/style/StyleScope.cpp
M Source/WebCore/style/StyleScope.h
Log Message:
-----------
Implementing CounterStyleRegistry for reference resolution
https://bugs.webkit.org/show_bug.cgi?id=249870
rdar://problem/103685490
Reviewed by Antti Koivisto and Myles C. Maxfield.
CSSCounterStyleRegistry keeps a collection of CounterStyle objects.
It is able to resolve references among the objects as needed by
the fallback feature and the extended system.
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
Adding CSSCounterStyleRegistry .cpp and .h files.
* Source/WebCore/css/CSSCounterStyleRegistry.cpp: Added.
(WebCore::CounterStyleRegistry::resolveReferences):
Resolve fallback and extend references for all the CounterStyle objects
in the registry.
(WebCore::CounterStyleRegistry::resolveExtendsReference):
Resolve Extend references for the counter styles with unresolved
references in the registry as described by
https://www.w3.org/TR/css-counter-styles-3/#extends-system.
(WebCore::CounterStyleRegistry::resolveFallbackReference):
Resolve fallback references for all counter styles with unresolved
references in the registry as described by
https://www.w3.org/TR/css-counter-styles-3/#counter-style-fallback.
(WebCore::CounterStyleRegistry::create):
(WebCore::CounterStyleRegistry::addCounterStyle):
Add counter style to the registry.
(WebCore::CounterStyleRegistry::getDecimalCounter):
(WebCore::CounterStyleRegistry::counterStyleForName):
Get counter style for a given name.
(WebCore::CounterStyleRegistry::userAgentCounterStyles):
(WebCore::CounterStyleRegistry::operator== const):
* Source/WebCore/css/CSSCounterStyleRegistry.h: Added.
* Source/WebCore/css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
* Source/WebCore/css/CSSCounterStyleRule.h:
* Source/WebCore/css/CSSValueKeywords.in:
Adding CounterStyle as value to ListStyleType.
* Source/WebCore/css/parser/CSSParserImpl.h:
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleSystem):
* Source/WebCore/rendering/RenderListMarker.cpp:
(WebCore::effectiveListMarkerType):
(WebCore::listMarkerSuffix):
(WebCore::listMarkerText):
(WebCore::RenderListMarker::updateContent):
(WebCore::RenderListMarker::counterStyle const):
* Source/WebCore/rendering/RenderListMarker.h:
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::counterStyleRegistry const):
(WebCore::RenderStyle::setCounterStyleRegistry):
* Source/WebCore/rendering/style/RenderStyle.h:
(WebCore::RenderStyle::initialCounterStyleRegistry):
* Source/WebCore/rendering/style/RenderStyleConstants.h:
Adding CounterStyle as value to ListStyleType enum.
* Source/WebCore/rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* Source/WebCore/rendering/style/StyleRareInheritedData.h:
Adding a CounterStyleRegistry member to RenderStyle such that
the counter styles can be availble during rendering.
* Source/WebCore/style/MatchedDeclarationsCache.cpp:
(WebCore::Style::MatchedDeclarationsCache::isCacheable):
(): Deleted.
* Source/WebCore/style/RuleSetBuilder.cpp:
(WebCore::Style::RuleSetBuilder::addChildRules):
(WebCore::Style::RuleSetBuilder::addMutatingRulesToResolver):
Processing counter style rules and adding them as CounterStyle objects
to the CounterStyleRegistry hold by the StyleResolver.
* Source/WebCore/style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueListStyleType):
(WebCore::Style::BuilderCustom::applyValueContent):
We can now handle custom-ident as list-style-type, as this is the
required type for describing a custom-style with an at-rule. For that
case, a CounterStyleRegistry will be recovered from the document's style
Scope and added to RenderStyle such that it can be used later for
rendering. This branch will not be reached until custom-ident is added
as a type for list-style-type parser grammar in CSSProperties.json,
which will be defered until we can properly render the counter styles.
* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::ensureCounterStyleRegistry):
(WebCore::Style::Resolver::addCounterStyle):
(WebCore::Style::Resolver::counterStyleForName):
* Source/WebCore/style/StyleResolver.h:
* Source/WebCore/style/StyleScope.h:
(WebCore::Style::Scope::resolverIfExists const):
(WebCore::Style::Scope::resolverIfExists): Deleted.
StyleResolver has now a CounterStyleRegistry for holding CounterStyle
objects added during the process of rules in RuleSetBuilder.
The registry will be recovered later when building the style for
list-style-type (StyleBuilderCustom.h)
Canonical link: https://commits.webkit.org/258510@main
More information about the webkit-changes
mailing list