[webkit-changes] [WebKit/WebKit] ac2f8a: Implementing CounterStyle representation from Styl...

Vitor Roriz noreply at github.com
Wed Jan 4 09:16:02 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ac2f8a4229ceb0edf14da7a59709f299970836b4
      https://github.com/WebKit/WebKit/commit/ac2f8a4229ceb0edf14da7a59709f299970836b4
  Author: Vitor Roriz <vitor.roriz at apple.com>
  Date:   2023-01-04 (Wed, 04 Jan 2023)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/css/CSSCounterStyle.cpp
    A Source/WebCore/css/CSSCounterStyle.h
    A Source/WebCore/css/CSSCounterStyleDescriptors.cpp
    A Source/WebCore/css/CSSCounterStyleDescriptors.h
    M Source/WebCore/css/CSSCounterStyleRule.cpp
    M Source/WebCore/css/CSSCounterStyleRule.h
    M Source/WebCore/css/CSSStyleSheet.cpp
    M Source/WebCore/css/CSSValueKeywords.in
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/style/MatchedDeclarationsCache.cpp

  Log Message:
  -----------
  Implementing CounterStyle representation from StyleRuleCounterStyle
https://bugs.webkit.org/show_bug.cgi?id=248666
rdar://102910060

Reviewed by Antti Koivisto.
Reviewed by Antti Koivisto.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
Adding CSSCounterStyle and CSSCounterStyleDescriptors .h and .cpp files.

* Source/WebCore/css/CSSCounterStyle.cpp: Added.
(WebCore::CounterStyle::isInRange const):
Returns true if counter is in range, as defined by
https://www.w3.org/TR/css-counter-styles-3/#descdef-counter-style-range.

(WebCore::CounterStyle::CounterStyle):
(WebCore::CounterStyle::create):

(WebCore::CounterStyle::createCounterStyleDecimal):
Create a CounterStyle object representing a Decimal counter.

(WebCore::CounterStyle::setFallbackReference):

(WebCore::CounterStyle::extendAndResolve):
Extend another CounterStyle as defined by
https://www.w3.org/TR/css-counter-styles-3/#extends-system and resolve
its Extend reference. The counter's system value is then promoted
from 'extend' to the valye of the CounterStyle we are extending.

(WebCore::CounterStyle::text):
Dummy text representation for the counter. The real representation wil
be implemented by rdar://103648354.

* Source/WebCore/css/CSSCounterStyle.h: Added.
(WebCore::CounterStyle::operator== const):
(WebCore::CounterStyle::fallbackName const):
(WebCore::CounterStyle::extendsName const):
(WebCore::CounterStyle::isFallbackUnresolved):
(WebCore::CounterStyle::isExtendsUnresolved):
(WebCore::CounterStyle::isExtendsSystem const):
(WebCore::CounterStyle::system const):
(WebCore::CounterStyle::isPredefinedCounterStyle const):
Returns true if CounterStyle is predefined by the user agent stylesheet.
A counter style parsed from author-defined rule will return false.

(WebCore::CounterStyle::isAutoRange const):
Returns true if the range descriptor is set to 'auto'. A 'auto' value
is represented by a empty vector of ranges.

* Source/WebCore/css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
* Source/WebCore/css/CSSCounterStyleRule.h:
Moving enum to CSSCounterStyle.h.
Adding getters for the properties's CSS values.

* Source/WebCore/css/CSSStyleSheet.cpp:
* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleSystem):
* Source/WebCore/dom/Element.h:
* Source/WebCore/style/MatchedDeclarationsCache.cpp:
(WebCore::Style::MatchedDeclarationsCache::isCacheable):
Adding FIXME with matching radars.

CSSCounterStyleDescriptors defines the descriptors for the counter-style
rule in a specialized manner. It serves as a payload for CSSCounterStyle.

* Source/WebCore/css/CSSCounterStyleDescriptors.cpp: Added.
(WebCore::translateRangeFromStyleProperties):
(WebCore::symbolToString):
(WebCore::translatePadFromStyleProperties):
(WebCore::translateNegativeSymbolsFromStyleProperties):
(WebCore::translateSymbolsFromStyleProperties):
(WebCore::translateFallbackNameFromStyleProperties):
(WebCore::translatePrefixFromStyleProperties):
(WebCore::translateSuffixFromStyleProperties):
(WebCore::extractDataFromSystemDescriptor):
(WebCore::CSSCounterStyleDescriptors::setExplicitlySetDescriptors):
Translation from CSSValues of rule's properties to adequated
specialized types.
(WebCore::CSSCounterStyleDescriptors::create):
Creates an instance of CSSCounterStyleDescriptor based on
StyleProperties. A create function was preferred instead of a
constructor in order to maintain the class as a aggregate, enabling
desginated initializers.
* Source/WebCore/css/CSSCounterStyleDescriptors.h: Added.

Canonical link: https://commits.webkit.org/258434@main




More information about the webkit-changes mailing list