Commit 57730b4
committed
Support ::before and ::after pseudo elements after ::slotted
https://bugs.webkit.org/show_bug.cgi?id=178237
Reviewed by Ryosuke Niwa.
LayoutTests/imported/w3c:
Update the tests from WPT repo.
* web-platform-tests/css/css-scoping/host-context-parsing-expected.txt: Added.
* web-platform-tests/css/css-scoping/host-context-parsing.html: Added.
* web-platform-tests/css/css-scoping/host-parsing-expected.txt: Added.
* web-platform-tests/css/css-scoping/host-parsing.html: Added.
* web-platform-tests/css/css-scoping/keyframes-001-expected.txt:
* web-platform-tests/css/css-scoping/shadow-shared-style-cache-001-expected.txt: Added.
* web-platform-tests/css/css-scoping/shadow-shared-style-cache-001.html: Added.
* web-platform-tests/css/css-scoping/slotted-link-expected.txt:
* web-platform-tests/css/css-scoping/slotted-parsing-expected.txt:
* web-platform-tests/css/css-scoping/slotted-parsing.html:
* web-platform-tests/css/css-scoping/w3c-import.log:
Source/WebCore:
Change the way we resolve ::slotted to improve compatibility. We now traverse through the assigned slot chain in
a single pass, similar to ::part matching.
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
* css/CSSSelector.h:
Add a new selection relation ShadowSlotted, similar to the existing ShadowDescendant and ShadowPartDescendant,
for switching scopes during selector matching.
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchRecursively const):
Find the right scope to continue matching on ShadowSlotted relation. Pass in the scope ordinal to find the scope.
(WebCore::SelectorChecker::checkOne const):
Match the ::slotted() element.
* css/SelectorChecker.h:
* css/SelectorFilter.cpp:
(WebCore::collectSelectorHashes):
* css/parser/CSSParserSelector.h:
(WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching const):
* css/parser/CSSSelectorParser.cpp:
(WebCore::isPseudoClassValidAfterPseudoElement):
(WebCore::isTreeAbidingPseudoElement):
Add a spec-termed helper.
(WebCore::isSimpleSelectorValidAfterPseudoElement):
(WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator):
Insert ShadowSlotted relation for ::slotted().
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
(WebCore::SelectorCompiler::constructFragmentsInternal):
* style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::clearMatchedRules):
(WebCore::Style::ElementRuleCollector::matchSlottedPseudoElementRules):
Simply get the rules from scopes in the assinged slot chaing and match against them.
No need for two passes.
(WebCore::Style::ElementRuleCollector::ruleMatches):
(WebCore::Style::ElementRuleCollector::collectMatchingRulesForList):
(WebCore::Style::ElementRuleCollector::collectSlottedPseudoElementRulesForSlot): Deleted.
Not needed anymore.
(WebCore::Style::findSlottedPseudoElementSelector): Deleted.
* style/ElementRuleCollector.h:
* style/RuleFeature.cpp:
(WebCore::Style::RuleFeatureSet::computeNextMatchElement):
LayoutTests:
* TestExpectations:
Canonical link: https://commits.webkit.org/243623@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284973 268f45cc-cd09-0410-ab3c-d52691b4dbfc1 parent 7fd76d1 commit 57730b4
26 files changed
Lines changed: 294 additions & 95 deletions
File tree
- LayoutTests
- imported/w3c
- web-platform-tests/css/css-scoping
- Source/WebCore
- cssjit
- css
- parser
- style
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3097 | 3097 | | |
3098 | 3098 | | |
3099 | 3099 | | |
3100 | | - | |
3101 | 3100 | | |
3102 | 3101 | | |
3103 | 3102 | | |
| |||
3208 | 3207 | | |
3209 | 3208 | | |
3210 | 3209 | | |
3211 | | - | |
3212 | 3210 | | |
3213 | 3211 | | |
3214 | 3212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
1 | 22 | | |
2 | 23 | | |
3 | 24 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
0 commit comments