[webkit-changes] [WebKit/WebKit] bfcf9b: [@starting-style] Add parsing support

Antti Koivisto noreply at github.com
Tue Jan 23 02:45:25 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bfcf9bf5da23fd0e272fa6b63fd1f6830322a576
      https://github.com/WebKit/WebKit/commit/bfcf9bf5da23fd0e272fa6b63fd1f6830322a576
  Author: Antti Koivisto <antti at apple.com>
  Date:   2024-01-23 (Tue, 23 Jan 2024)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/starting-style-name-defining-rules-expected.txt
    R LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-transitions/starting-style-name-defining-rules-expected.txt
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/bindings/js/JSCSSRuleCustom.cpp
    M Source/WebCore/css/StyleRule.cpp
    M Source/WebCore/css/StyleRule.h
    M Source/WebCore/css/StyleRuleType.h
    M Source/WebCore/css/StyleSheetContents.cpp
    M Source/WebCore/css/parser/CSSAtRuleID.cpp
    M Source/WebCore/css/parser/CSSAtRuleID.h
    M Source/WebCore/css/parser/CSSParserContext.cpp
    M Source/WebCore/css/parser/CSSParserContext.h
    M Source/WebCore/css/parser/CSSParserImpl.cpp
    M Source/WebCore/css/parser/CSSParserImpl.h
    M Source/WebCore/inspector/InspectorStyleSheet.cpp
    M Source/WebCore/style/ElementRuleCollector.cpp
    M Source/WebCore/style/MatchResult.h
    M Source/WebCore/style/PropertyCascade.cpp
    M Source/WebCore/style/PropertyCascade.h
    M Source/WebCore/style/RuleData.cpp
    M Source/WebCore/style/RuleData.h
    M Source/WebCore/style/RuleSet.cpp
    M Source/WebCore/style/RuleSetBuilder.cpp
    M Source/WebCore/style/RuleSetBuilder.h

  Log Message:
  -----------
  [@starting-style] Add parsing support
https://bugs.webkit.org/show_bug.cgi?id=267855
rdar://121373181

Reviewed by Matthieu Dubet.

Add support for parsing @starting-style rules.

https://drafts.csswg.org/css-transitions-2/#at-ruledef-starting-style

The styles are not actually used yet.

* LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/starting-style-name-defining-rules-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:

Add a setting. Not enabled yet.

* Source/WebCore/bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
* Source/WebCore/css/StyleRule.cpp:
(WebCore::StyleRuleBase::visitDerived):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
(WebCore::StyleRuleScope::styleSheetContents const):
(WebCore::StyleRuleScope::setStyleSheetContents):
(WebCore::StyleRuleStartingStyle::create):
(WebCore::StyleRuleStartingStyle::StyleRuleStartingStyle):

Add a StyleRule.

* Source/WebCore/css/StyleRule.h:
(WebCore::StyleRuleBase::isGroupRule const):
(WebCore::StyleRuleBase::isStartingStyleRule const):
(isType):
* Source/WebCore/css/StyleRuleType.h:
* Source/WebCore/css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::traverseSubresources const):
* Source/WebCore/css/parser/CSSAtRuleID.cpp:
(WebCore::cssAtRuleID):
* Source/WebCore/css/parser/CSSAtRuleID.h:
* Source/WebCore/css/parser/CSSParserContext.cpp:
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeAtRule):
(WebCore::CSSParserImpl::consumeStartingStyleRule):

Parse the rule. This is simple as there are no arguments to parse.

* Source/WebCore/css/parser/CSSParserImpl.h:
* Source/WebCore/inspector/InspectorStyleSheet.cpp:
(WebCore::flatteningStrategyForStyleRuleType):
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::transferMatchedRules):
* Source/WebCore/style/MatchResult.h:
(WebCore::Style::operator==):
(WebCore::Style::add):

Pass if a given declaration belongs to starting-style.

* Source/WebCore/style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::addMatch):

Skip @starting-style rules unless we are building a before-change RenderStyle.
With this patch we always skip.

* Source/WebCore/style/PropertyCascade.h:
* Source/WebCore/style/RuleData.cpp:
(WebCore::Style::RuleData::RuleData):
* Source/WebCore/style/RuleData.h:
(WebCore::Style::RuleData::isStartingStyle const):

Remember if the rule is part of a starting-style.

* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRule):
* Source/WebCore/style/RuleSetBuilder.cpp:
(WebCore::Style::RuleSetBuilder::addChildRule):

Gather child rules from @starting-style.

(WebCore::Style::RuleSetBuilder::addStyleRuleWithSelectorList):
* Source/WebCore/style/RuleSetBuilder.h:

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




More information about the webkit-changes mailing list