[webkit-changes] [WebKit/WebKit] 0bc5d3: [CSS] :scope matching for multiple scoping roots

Matthieu Dubet noreply at github.com
Mon Dec 4 13:54:41 PST 2023


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

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/fast/css/scope-at-rule-expected.html
    M LayoutTests/fast/css/scope-at-rule.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-container-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-evaluation-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-focus-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-hover-expected.txt
    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-invalidation-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-layer-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-media-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-nesting-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-supports-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-visited-cssom-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/conditional-rules.html
    M Source/WebCore/cssjit/SelectorCompiler.cpp
    M Source/WebCore/style/ElementRuleCollector.cpp
    M Source/WebCore/style/ElementRuleCollector.h

  Log Message:
  -----------
  [CSS] :scope matching for multiple scoping roots
https://bugs.webkit.org/show_bug.cgi?id=265288
rdar://118748899

Reviewed by Antti Koivisto.

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

This patch generates multiple matched rules, one for each scoping root.
They will all participate in the selector matching with a distinct :scope, and will be selected
based on specificity (and proximity in a future patch).

* LayoutTests/TestExpectations:
* LayoutTests/fast/css/scope-at-rule-expected.html:
* LayoutTests/fast/css/scope-at-rule.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-container-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-evaluation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-focus-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-hover-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-implicit-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-invalidation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-layer-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-media-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-nesting-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-supports-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-visited-cssom-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/conditional-rules.html:
* Source/WebCore/cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsScopeRoot):

Remove the assumption that :scope always means :root outside of SelectorQuery

* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::ruleMatches):
(WebCore::Style::ElementRuleCollector::collectMatchingRulesForList):
(WebCore::Style::ElementRuleCollector::scopeRulesMatch):
* Source/WebCore/style/ElementRuleCollector.h:

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




More information about the webkit-changes mailing list