Skip to content

[@starting-style] Add parsing support - #23044

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
anttijk:starting-style-initial
Jan 23, 2024
Merged

webkit-commit-queue merged 1 commit into
WebKit:mainfrom
anttijk:starting-style-initial

Conversation

@anttijk

@anttijk anttijk commented Jan 22, 2024 •

Copy link
Copy Markdown
Contributor

bfcf9bf

[@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

af22af6

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug   🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2   🧪 gtk-wk2
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
  🛠 tv-sim ✅ 🛠 jsc-armv7
✅ 🛠 🧪 merge ✅ 🛠 watch   🧪 jsc-armv7-tests
✅ 🛠 watch-sim

@anttijk anttijk self-assigned this Jan 22, 2024
@anttijk anttijk added the CSS Cascading Style Sheets implementation label Jan 22, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jan 22, 2024
Comment on lines 3 to 4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@graouts
graouts requested review from mdubet and nt1m January 22, 2024 19:26
@nt1m nt1m added merging-blocked Applied to prevent a change from being merged and removed merging-blocked Applied to prevent a change from being merged labels Jan 22, 2024
@nt1m

nt1m commented Jan 22, 2024

Copy link
Copy Markdown
Member

GTK/WPE baselines can probably be removed now that this is passing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nested group rules support mixing rules and declarations at the same level. It's unclear to me from the spec and the tests if it's possible to have them mixed here, or if we should have only rules or only declarations (and discard the other?)

Comment thread Source/WebCore/style/RuleSetBuilder.cpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL SetForScope 👍

Comment thread Source/WebCore/style/RuleSetBuilder.h Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a boolean enough or we will need a more complex mechanism (like the above integer identifier) to identify exactly which @starting-style ?

@nt1m nt1m Jan 22, 2024 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't nest multiple @starting-style within each other so I doubt you'll need an integer ID

@nt1m nt1m Jan 22, 2024 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Even if nesting of @starting-style were allowed (which I'm not sure of), it would have the same meaning at just using one @starting-style)

@anttijk anttijk removed the merging-blocked Applied to prevent a change from being merged label Jan 23, 2024
@anttijk
anttijk force-pushed the starting-style-initial branch from b901fcd to af22af6 Compare January 23, 2024 09:23
@anttijk anttijk added the merge-queue Applied to send a pull request to merge-queue label Jan 23, 2024
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
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 273351@main (bfcf9bf): https://commits.webkit.org/273351@main

Reviewed commits have been landed. Closing PR #23044 and removing active labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CSS Cascading Style Sheets implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants