Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CSS Nesting: nested selector matching
https://bugs.webkit.org/show_bug.cgi?id=249746 rdar://103147183 Reviewed by Antti Koivisto. This patch implements nested selector matching by creating the flat equivalent of the nested selector at rule set builder time. All the following steps (matching, selector jit compilation,...) should be automatically working because they will operate on regular flat selector, without any parent selector inside them. * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-001-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-002-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-003-expected.txt: * Source/WebCore/css/CSSSelector.cpp: (WebCore::simpleSelectorSpecificity): (WebCore::CSSSelector::selectorText const): (WebCore::CSSSelector::RareData::RareData): (WebCore::CSSSelector::RareData::deepCopy const): (WebCore::CSSSelector::CSSSelector): (WebCore::CSSSelector::visitAllSimpleSelectors const): (WebCore::CSSSelector::resolveNestingParentSelectors): (WebCore::CSSSelector::hasExplicitNestingParent const): * Source/WebCore/css/CSSSelector.h: (WebCore::CSSSelector::selectorList): (WebCore::CSSSelector::setNotLastInSelectorList): (WebCore::CSSSelector::isFirstInTagHistory const): (WebCore::CSSSelector::isLastInTagHistory const): (WebCore::CSSSelector::setLastInTagHistory): (WebCore::CSSSelector::tagHistory): (WebCore::CSSSelector::CSSSelector): Deleted. * Source/WebCore/css/CSSSelectorList.cpp: (WebCore::CSSSelectorList::CSSSelectorList): * Source/WebCore/css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne const): * Source/WebCore/css/StyleRule.cpp: (WebCore::StyleRule::StyleRule): * Source/WebCore/css/StyleRule.h: * Source/WebCore/css/parser/CSSParserSelector.cpp: (WebCore::CSSParserSelector::CSSParserSelector): * Source/WebCore/css/parser/CSSParserSelector.h: (WebCore::CSSParserSelector::selector): * Source/WebCore/css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumeRelativeNestedSelector): (WebCore::CSSSelectorParser::consumeNesting): (WebCore::CSSSelectorParser::resolveNestingParent): * Source/WebCore/css/parser/CSSSelectorParser.h: * Source/WebCore/cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): * Source/WebCore/style/RuleData.h: (WebCore::Style::RuleData::selector const): * Source/WebCore/style/RuleSetBuilder.cpp: (WebCore::Style::RuleSetBuilder::addStyleRule): * Source/WebCore/style/RuleSetBuilder.h: Canonical link: https://commits.webkit.org/258367@main
- Loading branch information
Showing
18 changed files
with
214 additions
and
57 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
2 changes: 1 addition & 1 deletion
2
LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-001-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,4 +1,4 @@ | ||
Test passes if color is green. | ||
|
||
FAIL CSS Selectors nested invalidation on changed parent assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)" | ||
PASS CSS Selectors nested invalidation on changed parent | ||
|
2 changes: 1 addition & 1 deletion
2
LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-002-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,4 +1,4 @@ | ||
Test passes if color is green. | ||
|
||
FAIL CSS Selectors nested invalidation on changed child assert_equals: expected "rgb(255, 0, 0)" but got "rgb(0, 128, 0)" | ||
PASS CSS Selectors nested invalidation on changed child | ||
|
2 changes: 1 addition & 1 deletion
2
LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/invalidation-003-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,4 +1,4 @@ | ||
Test passes if color is green. | ||
|
||
FAIL CSS Selectors nested invalidation with :has() assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS CSS Selectors nested invalidation 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
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
Oops, something went wrong.