-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CSS] Matched element should be within the @scope
https://bugs.webkit.org/show_bug.cgi?id=265241 rdar://118713295 Reviewed by Antti Koivisto. This patch adds one part of the @scope matching algorithm: the matched element has to be within the scope. https://drafts.csswg.org/css-cascade-6/#scoped-styles * 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-deep-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-nesting-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-proximity-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-specificity-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-visited-cssom-expected.txt: * Source/WebCore/style/ElementRuleCollector.cpp: (WebCore::Style::ElementRuleCollector::matchUARules): (WebCore::Style::ElementRuleCollector::ruleMatches): (WebCore::Style::ElementRuleCollector::scopeRulesMatch): (WebCore::Style::ElementRuleCollector::matchAllRules): * Source/WebCore/style/RuleSetBuilder.cpp: (WebCore::Style::RuleSetBuilder::resolveSelectorListWithNesting): (WebCore::Style::RuleSetBuilder::addStyleRule): * Source/WebCore/style/RuleSetBuilder.h: Canonical link: https://commits.webkit.org/271104@main
- Loading branch information
Showing
16 changed files
with
117 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-deep-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Deep @scope nesting assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS Deep @scope nesting | ||
|
24 changes: 12 additions & 12 deletions
24
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-evaluation-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
|
||
FAIL Single scope assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS Single scope | ||
PASS Scope can not match its own root without :scope | ||
FAIL Selecting self with :scope assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
FAIL Single scope with limit assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS Single scope with limit | ||
FAIL Single scope, :scope pseudo in main selector assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
FAIL Single scope, :scope pseudo in to-selector assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
FAIL Multiple scopes, :scope pseudo in to-selector assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
FAIL Single scope, :scope pseudo in to-selector assert_equals: expected "rgb(0, 0, 0)" but got "rgb(0, 128, 0)" | ||
FAIL Multiple scopes, :scope pseudo in to-selector assert_equals: expected "rgb(0, 0, 0)" but got "rgb(0, 128, 0)" | ||
FAIL Inner @scope with :scope in from-selector assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
FAIL Multiple scopes from same @scope-rule, only one limited assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS Multiple scopes from same @scope-rule, only one limited | ||
PASS Multiple scopes from same @scope-rule, both limited | ||
FAIL Nested scopes assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS Nested scopes, reverse | ||
FAIL Nested scopes, with to-selector assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS Nested scopes | ||
FAIL Nested scopes, reverse assert_equals: expected "rgb(0, 0, 0)" but got "rgb(0, 128, 0)" | ||
PASS Nested scopes, with to-selector | ||
FAIL :scope selecting itself assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
FAIL The scoping limit is not in scope assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
FAIL Simulated inclusive scoping limit assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS Scope with no elements | ||
FAIL The scoping limit is not in scope assert_equals: expected "rgb(0, 0, 0)" but got "rgb(0, 128, 0)" | ||
FAIL Simulated inclusive scoping limit assert_equals: expected "rgb(0, 0, 0)" but got "rgb(0, 128, 0)" | ||
FAIL Scope with no elements assert_equals: expected "rgb(0, 0, 0)" but got "rgb(0, 128, 0)" | ||
PASS :scope direct adjacent sibling | ||
PASS :scope indirect adjacent sibling | ||
FAIL Relative selector inside @scope assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS :scope in two different compounds | ||
FAIL Scope root with :has() assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS Scope root with :has() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-implicit-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
|
||
FAIL @scope without prelude implicitly scopes to parent of owner node assert_equals: expected "1" but got "auto" | ||
FAIL @scope without prelude implicitly scopes to parent of owner node assert_equals: expected "auto" but got "1" | ||
FAIL :scope can style implicit root assert_equals: expected "1" but got "auto" | ||
FAIL @scope works with two identical stylesheets assert_equals: expected "1" but got "auto" | ||
FAIL @scope works with two identical stylesheets assert_equals: expected "auto" but got "1" | ||
PASS @scope with effectively empty :is() must not match anything | ||
PASS Implicit @scope has implicitly added :scope descendant combinator | ||
FAIL Implicit @scope has implicitly added :scope descendant combinator assert_equals: expected "auto" but got "1" | ||
FAIL Implicit @scope with inner relative selector assert_equals: expected "1" but got "auto" | ||
FAIL Implicit @scope with inner nesting selector assert_equals: expected "1" but got "auto" | ||
FAIL Implicit @scope with limit assert_equals: expected "1" but got "auto" | ||
FAIL Implicit @scope with limit assert_equals: expected "auto" but got "1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-nesting-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-proximity-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
FAIL Alternating light/dark assert_equals: expected "rgb(100, 100, 100)" but got "rgb(0, 0, 0)" | ||
FAIL Proximity wins over order of appearance assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
FAIL Specificity wins over proximity assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
FAIL Alternating light/dark assert_equals: expected "rgb(100, 100, 100)" but got "rgb(200, 200, 200)" | ||
FAIL Proximity wins over order of appearance assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)" | ||
PASS Specificity wins over proximity | ||
|
16 changes: 8 additions & 8 deletions
16
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-specificity-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
|
||
FAIL @scope (#main) { .b { } } assert_equals: scoped rule expected "1" but got "auto" | ||
FAIL @scope (#main) to (.b) { .a { } } assert_equals: scoped rule expected "1" but got "auto" | ||
FAIL @scope (#main, .foo, .bar) { #a { } } assert_equals: scoped rule expected "1" but got "auto" | ||
FAIL @scope (#main) { div.b { } } assert_equals: scoped rule expected "1" but got "auto" | ||
FAIL @scope (#main) { :scope .b { } } assert_equals: scoped rule expected "1" but got "auto" | ||
FAIL @scope (#main) { & .b { } } assert_equals: scoped rule expected "1" but got "auto" | ||
FAIL @scope (#main) { div .b { } } assert_equals: scoped rule expected "1" but got "auto" | ||
FAIL @scope (#main) { @scope (.a) { .b { } } } assert_equals: scoped rule expected "1" but got "auto" | ||
FAIL @scope (#main) { .b { } } assert_equals: scoped + unscoped expected "1" but got "2" | ||
FAIL @scope (#main) to (.b) { .a { } } assert_equals: scoped + unscoped expected "1" but got "2" | ||
FAIL @scope (#main, .foo, .bar) { #a { } } assert_equals: scoped + unscoped expected "1" but got "2" | ||
FAIL @scope (#main) { div.b { } } assert_equals: scoped + unscoped expected "1" but got "2" | ||
FAIL @scope (#main) { :scope .b { } } assert_equals: scoped + unscoped expected "1" but got "2" | ||
FAIL @scope (#main) { & .b { } } assert_equals: scoped + unscoped expected "1" but got "2" | ||
FAIL @scope (#main) { div .b { } } assert_equals: scoped + unscoped expected "1" but got "2" | ||
FAIL @scope (#main) { @scope (.a) { .b { } } } assert_equals: scoped + unscoped expected "1" but got "2" | ||
|
10 changes: 5 additions & 5 deletions
10
LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-visited-cssom-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters