-
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] Scoped style rules accept relative selector list
https://bugs.webkit.org/show_bug.cgi?id=265289 rdar://118749004 Reviewed by Antti Koivisto. Like nested style rule, scoped style rules accept a relative selector list as the prelude for their rule list. The implicit ":scope" or "&" in their prelude has to be added explicitely when necessary. https://drafts.csswg.org/css-cascade-6/#scoped-style-rules * LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-cssom.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/scope-nesting-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: For the moment, until the @scope feature is more complete, those tests passing or failing don't mean anything. * Source/WebCore/css/CSSSelector.cpp: (WebCore::CSSSelector::hasExplicitPseudoClassScope const): * Source/WebCore/css/CSSSelector.h: * Source/WebCore/css/StyleRule.h: (WebCore::StyleRuleBase::isGroupRule const): * Source/WebCore/css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumeRegularRuleList): (WebCore::CSSParserImpl::consumeScopeRule): (WebCore::CSSParserImpl::consumeStyleRule): * Source/WebCore/css/parser/CSSParserImpl.h: (WebCore::CSSParserImpl::isStyleNestedContext): (WebCore::CSSParserImpl::isNestedContext): * Source/WebCore/css/parser/CSSParserSelector.cpp: (WebCore::CSSParserSelector::hasExplicitPseudoClassScope const): (WebCore::CSSParserSelector::appendTagHistoryAsRelative): * Source/WebCore/css/parser/CSSParserSelector.h: * Source/WebCore/css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumeNestedComplexSelector): We move the code to add the prepend the implicit selector from CSSSelectorParser to CSSParserImpl where we know the type of the parent rule (because we need to preprend either & or :scope) (WebCore::CSSSelectorParser::resolveNestingParent): Canonical link: https://commits.webkit.org/271336@main
- Loading branch information
Showing
11 changed files
with
119 additions
and
49 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
12 changes: 6 additions & 6 deletions
12
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 + 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) { .b { } } assert_equals: unscoped + scoped expected "2" but got "1" | ||
FAIL @scope (#main) to (.b) { .a { } } assert_equals: unscoped + scoped expected "2" but got "1" | ||
FAIL @scope (#main, .foo, .bar) { #a { } } assert_equals: unscoped + scoped expected "2" but got "1" | ||
FAIL @scope (#main) { div.b { } } assert_equals: unscoped + scoped expected "2" but got "1" | ||
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" | ||
FAIL @scope (#main) { div .b { } } assert_equals: unscoped + scoped expected "2" but got "1" | ||
FAIL @scope (#main) { @scope (.a) { .b { } } } assert_equals: unscoped + scoped expected "2" 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
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
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