[webkit-changes] [WebKit/WebKit] 5d2ddd: [CSS] Add @scope rule to RuleSet

Matthieu Dubet noreply at github.com
Thu Nov 23 05:37:44 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5d2ddd6e61126370c7da861fd5f2034818a7960c
      https://github.com/WebKit/WebKit/commit/5d2ddd6e61126370c7da861fd5f2034818a7960c
  Author: Matthieu Dubet <m_dubet at apple.com>
  Date:   2023-11-23 (Thu, 23 Nov 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/css/scope-at-rule-expected.html
    A LayoutTests/fast/css/scope-at-rule.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-name-defining-rules-expected.txt
    M Source/WebCore/style/ElementRuleCollector.cpp
    M Source/WebCore/style/ElementRuleCollector.h
    M Source/WebCore/style/RuleSet.cpp
    M Source/WebCore/style/RuleSet.h
    M Source/WebCore/style/RuleSetBuilder.cpp
    M Source/WebCore/style/RuleSetBuilder.h
    M Source/WebCore/style/StyleScopeRuleSets.cpp
    M Source/WebCore/style/StyleScopeRuleSets.h
    M Source/WebCore/style/StyleSharingResolver.cpp

  Log Message:
  -----------
  [CSS] Add @scope rule to RuleSet
https://bugs.webkit.org/show_bug.cgi?id=264500
rdar://118181109

Reviewed by Antti Koivisto.

This patch implements the mechanism to get the ancestor @scope rules (if any)
during element rule collection.

It also desactivates style sharing for scoped rules.

The actual matching is not implemented yet.

https://drafts.csswg.org/css-cascade-6/#scoped-styles

* LayoutTests/TestExpectations:
* LayoutTests/fast/css/scope-at-rule-expected.html: Added.
* LayoutTests/fast/css/scope-at-rule.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-name-defining-rules-expected.txt:
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::collectMatchingRulesForList):
(WebCore::Style::ElementRuleCollector::scopeRulesMatch):
* Source/WebCore/style/ElementRuleCollector.h:
* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRule):
(WebCore::Style::RuleSet::scopeRulesFor const):
* Source/WebCore/style/RuleSet.h:
(WebCore::Style::RuleSet::hasScopeRules const):
* Source/WebCore/style/RuleSetBuilder.cpp:
(WebCore::Style::RuleSetBuilder::addChildRule):
(WebCore::Style::RuleSetBuilder::addStyleRuleWithSelectorList):
* Source/WebCore/style/RuleSetBuilder.h:
* Source/WebCore/style/StyleScopeRuleSets.cpp:
(WebCore::Style::ScopeRuleSets::hasScopeRules const):
* Source/WebCore/style/StyleScopeRuleSets.h:
* Source/WebCore/style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::resolve):

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




More information about the webkit-changes mailing list