[webkit-changes] [WebKit/WebKit] f0fd3c: [css-nesting] New behavior for interleaved declara...

Matthieu Dubet noreply at github.com
Wed Sep 4 20:43:51 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f0fd3ce9cf0c9319184d3f49ce6752864dece7ca
      https://github.com/WebKit/WebKit/commit/f0fd3ce9cf0c9319184d3f49ce6752864dece7ca
  Author: Matthieu Dubet <m_dubet at apple.com>
  Date:   2024-09-04 (Wed, 04 Sep 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/cssom-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/cssom.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/mixed-declarations-rules-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/mixed-declarations-rules.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/nested-declarations-cssom-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/nested-declarations-matching-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/serialize-group-rules-with-decls-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-syntax/custom-property-rule-ambiguity.html
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/DerivedSources-input.xcfilelist
    M Source/WebCore/DerivedSources-output.xcfilelist
    M Source/WebCore/DerivedSources.make
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/bindings/js/JSCSSRuleCustom.cpp
    M Source/WebCore/css/CSSGradientValue.h
    M Source/WebCore/css/CSSGroupingRule.cpp
    A Source/WebCore/css/CSSNestedDeclarations.cpp
    A Source/WebCore/css/CSSNestedDeclarations.h
    A Source/WebCore/css/CSSNestedDeclarations.idl
    M Source/WebCore/css/CSSShapeSegmentValue.cpp
    M Source/WebCore/css/CSSStyleRule.cpp
    M Source/WebCore/css/CSSStyleRule.h
    M Source/WebCore/css/CSSTimingFunctionValue.h
    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/calc/CSSCalcTree+Simplification.cpp
    M Source/WebCore/css/parser/CSSParser.h
    M Source/WebCore/css/parser/CSSParserImpl.cpp
    M Source/WebCore/css/parser/CSSParserImpl.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Image.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Image.h
    M Source/WebCore/inspector/InspectorStyleSheet.cpp
    M Source/WebCore/style/RuleSetBuilder.cpp
    M Source/WebCore/style/RuleSetBuilder.h

  Log Message:
  -----------
  [css-nesting] New behavior for interleaved declarations and rules
https://bugs.webkit.org/show_bug.cgi?id=275365
rdar://130094168

Reviewed by Tim Nguyen.

https://github.com/w3c/csswg-drafts/issues/10234

Before this CSSWG resolution, any declaration inside a style rule
(whatever its position relative to other rules),
would be shifted up at the top of the rule
to be able to represent a style rule with a single leading block of declarations.
This patch implements the new resolved behavior so the order of interleaved declarations is respected
during cascade.

https://drafts.csswg.org/css-nesting/#the-cssnestrule

This patch introduces a new StyleRuleNestedDeclarations class
to be able to store a block of declarations in-between rules and fit with the already existing
RuleData/RuleSet mechanism.
Its CSSOM representation (CSSNestedDeclarations) is purposedly not serialized
as a rule in the CSSOM but like a list of declarations.

The CSSOM insertRule() functions (on CSSStyleRule/CSSGroupingRule)
are modified to allow inserting block of declarations.
https://github.com/w3c/csswg-drafts/issues/10520

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/cssom-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/cssom.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/mixed-declarations-rules-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/mixed-declarations-rules.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/nested-declarations-cssom-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/nested-declarations-matching-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/serialize-group-rules-with-decls-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-syntax/custom-property-rule-ambiguity.html:  Manual sync from WPT
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
* Source/WebCore/css/CSSGradientValue.h:
* Source/WebCore/css/CSSNestedDeclarations.cpp: Added.
(WebCore::CSSNestedDeclarations::CSSNestedDeclarations):
(WebCore::CSSNestedDeclarations::style):
(WebCore::CSSNestedDeclarations::cssText const):
(WebCore::CSSNestedDeclarations::reattach):
* Source/WebCore/css/CSSNestedDeclarations.h: Added.
* Source/WebCore/css/CSSNestedDeclarations.idl: Added.
* Source/WebCore/css/CSSShapeSegmentValue.cpp:
* Source/WebCore/css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::insertRule):
* Source/WebCore/css/CSSStyleRule.h:
* Source/WebCore/css/StyleRule.cpp:
(WebCore::StyleRuleBase::visitDerived):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
(WebCore::StyleRuleNestedDeclarations::StyleRuleNestedDeclarations):
(WebCore::StyleRuleNestedDeclarations::debugDescription const):
* Source/WebCore/css/StyleRule.h:
(WebCore::StyleRuleBase::isStyleRuleNestedDeclarations const):
(isType):
* Source/WebCore/css/StyleRuleType.h:
* Source/WebCore/css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::traverseRules const):
(WebCore::StyleSheetContents::traverseSubresources const):
(WebCore::StyleSheetContents::mayDependOnBaseURL const):
* Source/WebCore/css/calc/CSSCalcTree+Simplification.cpp:
* Source/WebCore/css/calc/CSSCalcTree+Simplification.h:
* Source/WebCore/css/parser/CSSParser.h:
* Source/WebCore/css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::parseNestedDeclarations):
(WebCore::CSSParserImpl::createNestedDeclarationsRule):
(WebCore::CSSParserImpl::consumeNestedGroupRules):
(WebCore::CSSParserImpl::consumeBlockContent):
(WebCore::CSSParserImpl::createNestingParentRule): Deleted.
* Source/WebCore/css/parser/CSSParserImpl.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Image.cpp:
(WebCore::CSSPropertyParserHelpers::consumeImageSetResolutionOrTypeFunction):
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Image.h:
* Source/WebCore/inspector/InspectorStyleSheet.cpp:
(WebCore::flatteningStrategyForStyleRuleType):
* Source/WebCore/style/RuleSetBuilder.cpp:
(WebCore::Style::RuleSetBuilder::addChildRule):
(WebCore::Style::RuleSetBuilder::addStyleRule):
* Source/WebCore/style/RuleSetBuilder.h:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list