[webkit-changes] [WebKit/WebKit] cee867: [CSS] Implement @scope implicit

Matthieu Dubet noreply at github.com
Wed Dec 20 16:34:15 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cee867893141fabf4fdeed3603a8986b74af3f88
      https://github.com/WebKit/WebKit/commit/cee867893141fabf4fdeed3603a8986b74af3f88
  Author: Matthieu Dubet <m_dubet at apple.com>
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
    M LayoutTests/fast/css/scope-at-rule-expected.html
    A LayoutTests/fast/css/scope-at-rule-green-14.css
    M LayoutTests/fast/css/scope-at-rule.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/at-scope-parsing-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/at-scope-parsing.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-implicit-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-implicit-external-expected.txt
    M Source/WebCore/css/StyleRule.cpp
    M Source/WebCore/css/StyleRule.h
    M Source/WebCore/css/StyleSheetContents.cpp
    M Source/WebCore/css/StyleSheetContents.h
    M Source/WebCore/css/parser/CSSParserImpl.cpp
    M Source/WebCore/style/ElementRuleCollector.cpp
    M Source/WebCore/style/ElementRuleCollector.h
    M Source/WebCore/style/RuleSetBuilder.cpp

  Log Message:
  -----------
  [CSS] Implement @scope implicit
https://bugs.webkit.org/show_bug.cgi?id=266399
rdar://119659940

Reviewed by Antti Koivisto.

When the @scope rule doesn't have a <scope-start> prelude,
the scoping root is the parent element of the owner node of the stylesheet
where the @scope rule is defined.

We store in the @scope rule a pointer to the owner StyleSheetContent,
which will allow us to find the parent element of it at rule matching time,
to determine the scoping root(s).

https://drafts.csswg.org/css-cascade-6/#scope-limits

* LayoutTests/fast/css/scope-at-rule-expected.html:
* LayoutTests/fast/css/scope-at-rule-green-14.css: Added.
(@scope):
* LayoutTests/fast/css/scope-at-rule.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/at-scope-parsing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/at-scope-parsing.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-implicit-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-implicit-external-expected.txt:
* Source/WebCore/css/StyleRule.cpp:
(WebCore::StyleRuleScope::styleSheetContents const):
(WebCore::StyleRuleScope::setStyleSheetContents):
* Source/WebCore/css/StyleRule.h:
* Source/WebCore/css/StyleSheetContents.h:
* Source/WebCore/css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeScopeRule):
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::ruleMatches):
(WebCore::Style::ElementRuleCollector::scopeRulesMatch):
* Source/WebCore/style/ElementRuleCollector.h:
* Source/WebCore/style/RuleSetBuilder.cpp:
(WebCore::Style::RuleSetBuilder::addChildRule):

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




More information about the webkit-changes mailing list