haikuwebkit/LayoutTests/fast/selectors/pseudo-element-in-is-where....

16 lines
737 B
HTML
Raw Permalink Normal View History

[CSS selectors] :is() / :where() should not allow pseudo-elements at parse-time https://bugs.webkit.org/show_bug.cgi?id=210701 Reviewed by Anders Carlsson. Source/WebCore: https://drafts.csswg.org/selectors/#matches: "Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is()." Test: fast/selectors/pseudo-element-in-is-where.html * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): LayoutTests: Remove or update tests for pseudo elements inside :is()/:where(). Also add some :where() rountrip coverage. * fast/css/css-selector-text-expected.txt: * fast/css/css-selector-text.html: * fast/css/css-set-selector-text-expected.txt: * fast/css/css-set-selector-text.html: * fast/css/is-specificity-6-expected.html: Removed. * fast/css/is-specificity-6.html: Removed. * fast/css/matches-specificity-6-expected.html: Removed. * fast/css/matches-specificity-6.html: Removed. * fast/css/parsing-css-allowed-string-characters-expected.txt: * fast/css/parsing-css-is-1-expected.txt: * fast/css/parsing-css-is-1.html: * fast/css/parsing-css-is-2-expected.txt: * fast/css/parsing-css-is-2.html: * fast/css/parsing-css-is-3-expected.txt: * fast/css/parsing-css-is-3.html: * fast/css/parsing-css-is-4-expected.txt: * fast/css/parsing-css-is-4.html: * fast/css/parsing-css-matches-1-expected.txt: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2-expected.txt: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3-expected.txt: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4-expected.txt: * fast/css/parsing-css-matches-4.html: * fast/selectors/pseudo-element-in-is-where-expected.html: Added. * fast/selectors/pseudo-element-in-is-where.html: Added. * fast/selectors/pseudo-element-inside-is-expected.html: Removed. * fast/selectors/pseudo-element-inside-is.html: Removed. * fast/selectors/pseudo-element-inside-matches-expected.html: Removed. * fast/selectors/pseudo-element-inside-matches.html: Removed. * fast/selectors/querySelector-is-expected.txt: * fast/selectors/querySelector-is.html: * fast/selectors/querySelector-matches-expected.txt: * fast/selectors/querySelector-matches.html: Canonical link: https://commits.webkit.org/223598@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-19 17:51:19 +00:00
<!doctyle html>
<style>
Implement <forgiving-selector-list> for :is/:where https://bugs.webkit.org/show_bug.cgi?id=217814 <rdar://problem/70384483> Reviewed by Sam Weinig. LayoutTests/imported/w3c: * web-platform-tests/css/selectors/is-where-error-recovery-expected.txt: * web-platform-tests/css/selectors/is-where-not-expected.txt: Source/WebCore: The spec now says :is/:where should parse as a forgiving selector list: https://drafts.csswg.org/selectors/#matches * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidCSSSelector): * css/CSSPageRule.cpp: (WebCore::CSSPageRule::setSelectorText): * css/CSSSelectorList.h: (WebCore::CSSSelectorList::isEmpty const): (WebCore::CSSSelectorList::isValid const): Deleted. An empty CSSSelectorList is now valid. Represent invalid CSSSelectorList with Optional where needed. * css/CSSStyleRule.cpp: (WebCore::CSSStyleRule::setSelectorText): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSelector): * css/parser/CSSParser.h: * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumePageRule): (WebCore::CSSParserImpl::consumeStyleRule): * css/parser/CSSSelectorParser.cpp: (WebCore::parseCSSSelector): (WebCore::CSSSelectorParser::consumeComplexSelectorList): (WebCore::CSSSelectorParser::consumeComplexForgivingSelectorList): Add function for consuming <forgiving-selector-list>. (WebCore::CSSSelectorParser::consumePseudo): Use it for :is/:where. * css/parser/CSSSelectorParser.h: * dom/SelectorQuery.cpp: * inspector/InspectorStyleSheet.cpp: (WebCore::isValidSelectorListString): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::highlightSelector): * style/RuleSet.cpp: (WebCore::Style::RuleSet::addStyleRule): LayoutTests: Update some selector parsing tests to log the results instead of PASS/FAIL as forgiving parsing allows many combinations involving :is/:where. Remove a few repetetive tests that don't add anything. * fast/css/parsing-css-attribute-case-insensitive-value-4-expected.txt: Removed. * fast/css/parsing-css-attribute-case-insensitive-value-4.html: Removed. * fast/css/parsing-css-is-5-expected.txt: * fast/css/parsing-css-is-5.html: * fast/css/parsing-css-is-6-expected.txt: * fast/css/parsing-css-is-6.html: * fast/css/parsing-css-is-7-expected.txt: * fast/css/parsing-css-is-7.html: * fast/css/parsing-css-is-8-expected.txt: * fast/css/parsing-css-is-8.html: * fast/css/parsing-css-matches-5-expected.txt: Removed. * fast/css/parsing-css-matches-5.html: Removed. * fast/css/parsing-css-matches-6-expected.txt: Removed. * fast/css/parsing-css-matches-6.html: Removed. * fast/css/parsing-css-matches-7-expected.txt: Removed. * fast/css/parsing-css-matches-7.html: Removed. * fast/css/parsing-css-matches-8-expected.txt: Removed. * fast/css/parsing-css-matches-8.html: Removed. * fast/css/parsing-css-not-5-expected.txt: * fast/css/parsing-css-not-5.html: * fast/css/parsing-css-not-6-expected.txt: * fast/css/parsing-css-not-6.html: * fast/css/parsing-css-not-7-expected.txt: * fast/css/parsing-css-not-7.html: * fast/css/parsing-css-not-8-expected.txt: * fast/css/parsing-css-not-8.html: * fast/css/parsing-css-not-9-expected.txt: * fast/css/parsing-css-not-9.html: * fast/css/parsing-css-nth-child-of-4-expected.txt: * fast/css/parsing-css-nth-child-of-4.html: * fast/css/parsing-css-nth-last-child-of-4-expected.txt: * fast/css/parsing-css-nth-last-child-of-4.html: * fast/selectors/invalid-functional-pseudo-class-expected.txt: * fast/selectors/invalid-functional-pseudo-class.html: * fast/selectors/pseudo-element-in-is-where-expected.html: * fast/selectors/pseudo-element-in-is-where.html: Canonical link: https://commits.webkit.org/230692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268741 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-20 17:07:25 +00:00
:is(.test1) { color:green; background-color: red; }
:is(.test1, .test1::before) { background-color:white; }
:is(.test2)::before { color:green; content:'Test that a pseudo element is ignored in :is()'; }
[CSS selectors] :is() / :where() should not allow pseudo-elements at parse-time https://bugs.webkit.org/show_bug.cgi?id=210701 Reviewed by Anders Carlsson. Source/WebCore: https://drafts.csswg.org/selectors/#matches: "Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is()." Test: fast/selectors/pseudo-element-in-is-where.html * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): LayoutTests: Remove or update tests for pseudo elements inside :is()/:where(). Also add some :where() rountrip coverage. * fast/css/css-selector-text-expected.txt: * fast/css/css-selector-text.html: * fast/css/css-set-selector-text-expected.txt: * fast/css/css-set-selector-text.html: * fast/css/is-specificity-6-expected.html: Removed. * fast/css/is-specificity-6.html: Removed. * fast/css/matches-specificity-6-expected.html: Removed. * fast/css/matches-specificity-6.html: Removed. * fast/css/parsing-css-allowed-string-characters-expected.txt: * fast/css/parsing-css-is-1-expected.txt: * fast/css/parsing-css-is-1.html: * fast/css/parsing-css-is-2-expected.txt: * fast/css/parsing-css-is-2.html: * fast/css/parsing-css-is-3-expected.txt: * fast/css/parsing-css-is-3.html: * fast/css/parsing-css-is-4-expected.txt: * fast/css/parsing-css-is-4.html: * fast/css/parsing-css-matches-1-expected.txt: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2-expected.txt: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3-expected.txt: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4-expected.txt: * fast/css/parsing-css-matches-4.html: * fast/selectors/pseudo-element-in-is-where-expected.html: Added. * fast/selectors/pseudo-element-in-is-where.html: Added. * fast/selectors/pseudo-element-inside-is-expected.html: Removed. * fast/selectors/pseudo-element-inside-is.html: Removed. * fast/selectors/pseudo-element-inside-matches-expected.html: Removed. * fast/selectors/pseudo-element-inside-matches.html: Removed. * fast/selectors/querySelector-is-expected.txt: * fast/selectors/querySelector-is.html: * fast/selectors/querySelector-matches-expected.txt: * fast/selectors/querySelector-matches.html: Canonical link: https://commits.webkit.org/223598@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-19 17:51:19 +00:00
:is(.test2::before) { background-color:red; }
Implement <forgiving-selector-list> for :is/:where https://bugs.webkit.org/show_bug.cgi?id=217814 <rdar://problem/70384483> Reviewed by Sam Weinig. LayoutTests/imported/w3c: * web-platform-tests/css/selectors/is-where-error-recovery-expected.txt: * web-platform-tests/css/selectors/is-where-not-expected.txt: Source/WebCore: The spec now says :is/:where should parse as a forgiving selector list: https://drafts.csswg.org/selectors/#matches * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidCSSSelector): * css/CSSPageRule.cpp: (WebCore::CSSPageRule::setSelectorText): * css/CSSSelectorList.h: (WebCore::CSSSelectorList::isEmpty const): (WebCore::CSSSelectorList::isValid const): Deleted. An empty CSSSelectorList is now valid. Represent invalid CSSSelectorList with Optional where needed. * css/CSSStyleRule.cpp: (WebCore::CSSStyleRule::setSelectorText): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSelector): * css/parser/CSSParser.h: * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumePageRule): (WebCore::CSSParserImpl::consumeStyleRule): * css/parser/CSSSelectorParser.cpp: (WebCore::parseCSSSelector): (WebCore::CSSSelectorParser::consumeComplexSelectorList): (WebCore::CSSSelectorParser::consumeComplexForgivingSelectorList): Add function for consuming <forgiving-selector-list>. (WebCore::CSSSelectorParser::consumePseudo): Use it for :is/:where. * css/parser/CSSSelectorParser.h: * dom/SelectorQuery.cpp: * inspector/InspectorStyleSheet.cpp: (WebCore::isValidSelectorListString): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::highlightSelector): * style/RuleSet.cpp: (WebCore::Style::RuleSet::addStyleRule): LayoutTests: Update some selector parsing tests to log the results instead of PASS/FAIL as forgiving parsing allows many combinations involving :is/:where. Remove a few repetetive tests that don't add anything. * fast/css/parsing-css-attribute-case-insensitive-value-4-expected.txt: Removed. * fast/css/parsing-css-attribute-case-insensitive-value-4.html: Removed. * fast/css/parsing-css-is-5-expected.txt: * fast/css/parsing-css-is-5.html: * fast/css/parsing-css-is-6-expected.txt: * fast/css/parsing-css-is-6.html: * fast/css/parsing-css-is-7-expected.txt: * fast/css/parsing-css-is-7.html: * fast/css/parsing-css-is-8-expected.txt: * fast/css/parsing-css-is-8.html: * fast/css/parsing-css-matches-5-expected.txt: Removed. * fast/css/parsing-css-matches-5.html: Removed. * fast/css/parsing-css-matches-6-expected.txt: Removed. * fast/css/parsing-css-matches-6.html: Removed. * fast/css/parsing-css-matches-7-expected.txt: Removed. * fast/css/parsing-css-matches-7.html: Removed. * fast/css/parsing-css-matches-8-expected.txt: Removed. * fast/css/parsing-css-matches-8.html: Removed. * fast/css/parsing-css-not-5-expected.txt: * fast/css/parsing-css-not-5.html: * fast/css/parsing-css-not-6-expected.txt: * fast/css/parsing-css-not-6.html: * fast/css/parsing-css-not-7-expected.txt: * fast/css/parsing-css-not-7.html: * fast/css/parsing-css-not-8-expected.txt: * fast/css/parsing-css-not-8.html: * fast/css/parsing-css-not-9-expected.txt: * fast/css/parsing-css-not-9.html: * fast/css/parsing-css-nth-child-of-4-expected.txt: * fast/css/parsing-css-nth-child-of-4.html: * fast/css/parsing-css-nth-last-child-of-4-expected.txt: * fast/css/parsing-css-nth-last-child-of-4.html: * fast/selectors/invalid-functional-pseudo-class-expected.txt: * fast/selectors/invalid-functional-pseudo-class.html: * fast/selectors/pseudo-element-in-is-where-expected.html: * fast/selectors/pseudo-element-in-is-where.html: Canonical link: https://commits.webkit.org/230692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268741 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-20 17:07:25 +00:00
:where(.test3) { color:green; background-color: red; }
:where(.test3, .test3::before) { background-color:white; }
:where(.test4)::before { color:green; content:'Test that a pseudo element is ignored in :where()'; }
[CSS selectors] :is() / :where() should not allow pseudo-elements at parse-time https://bugs.webkit.org/show_bug.cgi?id=210701 Reviewed by Anders Carlsson. Source/WebCore: https://drafts.csswg.org/selectors/#matches: "Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is()." Test: fast/selectors/pseudo-element-in-is-where.html * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): LayoutTests: Remove or update tests for pseudo elements inside :is()/:where(). Also add some :where() rountrip coverage. * fast/css/css-selector-text-expected.txt: * fast/css/css-selector-text.html: * fast/css/css-set-selector-text-expected.txt: * fast/css/css-set-selector-text.html: * fast/css/is-specificity-6-expected.html: Removed. * fast/css/is-specificity-6.html: Removed. * fast/css/matches-specificity-6-expected.html: Removed. * fast/css/matches-specificity-6.html: Removed. * fast/css/parsing-css-allowed-string-characters-expected.txt: * fast/css/parsing-css-is-1-expected.txt: * fast/css/parsing-css-is-1.html: * fast/css/parsing-css-is-2-expected.txt: * fast/css/parsing-css-is-2.html: * fast/css/parsing-css-is-3-expected.txt: * fast/css/parsing-css-is-3.html: * fast/css/parsing-css-is-4-expected.txt: * fast/css/parsing-css-is-4.html: * fast/css/parsing-css-matches-1-expected.txt: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2-expected.txt: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3-expected.txt: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4-expected.txt: * fast/css/parsing-css-matches-4.html: * fast/selectors/pseudo-element-in-is-where-expected.html: Added. * fast/selectors/pseudo-element-in-is-where.html: Added. * fast/selectors/pseudo-element-inside-is-expected.html: Removed. * fast/selectors/pseudo-element-inside-is.html: Removed. * fast/selectors/pseudo-element-inside-matches-expected.html: Removed. * fast/selectors/pseudo-element-inside-matches.html: Removed. * fast/selectors/querySelector-is-expected.txt: * fast/selectors/querySelector-is.html: * fast/selectors/querySelector-matches-expected.txt: * fast/selectors/querySelector-matches.html: Canonical link: https://commits.webkit.org/223598@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-19 17:51:19 +00:00
:where(.test4::before) { background-color:red; }
</style>
Implement <forgiving-selector-list> for :is/:where https://bugs.webkit.org/show_bug.cgi?id=217814 <rdar://problem/70384483> Reviewed by Sam Weinig. LayoutTests/imported/w3c: * web-platform-tests/css/selectors/is-where-error-recovery-expected.txt: * web-platform-tests/css/selectors/is-where-not-expected.txt: Source/WebCore: The spec now says :is/:where should parse as a forgiving selector list: https://drafts.csswg.org/selectors/#matches * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidCSSSelector): * css/CSSPageRule.cpp: (WebCore::CSSPageRule::setSelectorText): * css/CSSSelectorList.h: (WebCore::CSSSelectorList::isEmpty const): (WebCore::CSSSelectorList::isValid const): Deleted. An empty CSSSelectorList is now valid. Represent invalid CSSSelectorList with Optional where needed. * css/CSSStyleRule.cpp: (WebCore::CSSStyleRule::setSelectorText): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSelector): * css/parser/CSSParser.h: * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumePageRule): (WebCore::CSSParserImpl::consumeStyleRule): * css/parser/CSSSelectorParser.cpp: (WebCore::parseCSSSelector): (WebCore::CSSSelectorParser::consumeComplexSelectorList): (WebCore::CSSSelectorParser::consumeComplexForgivingSelectorList): Add function for consuming <forgiving-selector-list>. (WebCore::CSSSelectorParser::consumePseudo): Use it for :is/:where. * css/parser/CSSSelectorParser.h: * dom/SelectorQuery.cpp: * inspector/InspectorStyleSheet.cpp: (WebCore::isValidSelectorListString): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::highlightSelector): * style/RuleSet.cpp: (WebCore::Style::RuleSet::addStyleRule): LayoutTests: Update some selector parsing tests to log the results instead of PASS/FAIL as forgiving parsing allows many combinations involving :is/:where. Remove a few repetetive tests that don't add anything. * fast/css/parsing-css-attribute-case-insensitive-value-4-expected.txt: Removed. * fast/css/parsing-css-attribute-case-insensitive-value-4.html: Removed. * fast/css/parsing-css-is-5-expected.txt: * fast/css/parsing-css-is-5.html: * fast/css/parsing-css-is-6-expected.txt: * fast/css/parsing-css-is-6.html: * fast/css/parsing-css-is-7-expected.txt: * fast/css/parsing-css-is-7.html: * fast/css/parsing-css-is-8-expected.txt: * fast/css/parsing-css-is-8.html: * fast/css/parsing-css-matches-5-expected.txt: Removed. * fast/css/parsing-css-matches-5.html: Removed. * fast/css/parsing-css-matches-6-expected.txt: Removed. * fast/css/parsing-css-matches-6.html: Removed. * fast/css/parsing-css-matches-7-expected.txt: Removed. * fast/css/parsing-css-matches-7.html: Removed. * fast/css/parsing-css-matches-8-expected.txt: Removed. * fast/css/parsing-css-matches-8.html: Removed. * fast/css/parsing-css-not-5-expected.txt: * fast/css/parsing-css-not-5.html: * fast/css/parsing-css-not-6-expected.txt: * fast/css/parsing-css-not-6.html: * fast/css/parsing-css-not-7-expected.txt: * fast/css/parsing-css-not-7.html: * fast/css/parsing-css-not-8-expected.txt: * fast/css/parsing-css-not-8.html: * fast/css/parsing-css-not-9-expected.txt: * fast/css/parsing-css-not-9.html: * fast/css/parsing-css-nth-child-of-4-expected.txt: * fast/css/parsing-css-nth-child-of-4.html: * fast/css/parsing-css-nth-last-child-of-4-expected.txt: * fast/css/parsing-css-nth-last-child-of-4.html: * fast/selectors/invalid-functional-pseudo-class-expected.txt: * fast/selectors/invalid-functional-pseudo-class.html: * fast/selectors/pseudo-element-in-is-where-expected.html: * fast/selectors/pseudo-element-in-is-where.html: Canonical link: https://commits.webkit.org/230692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268741 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-20 17:07:25 +00:00
<div class=test1>Test that a pseudo element is ignored in :is()</div>
[CSS selectors] :is() / :where() should not allow pseudo-elements at parse-time https://bugs.webkit.org/show_bug.cgi?id=210701 Reviewed by Anders Carlsson. Source/WebCore: https://drafts.csswg.org/selectors/#matches: "Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is()." Test: fast/selectors/pseudo-element-in-is-where.html * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): LayoutTests: Remove or update tests for pseudo elements inside :is()/:where(). Also add some :where() rountrip coverage. * fast/css/css-selector-text-expected.txt: * fast/css/css-selector-text.html: * fast/css/css-set-selector-text-expected.txt: * fast/css/css-set-selector-text.html: * fast/css/is-specificity-6-expected.html: Removed. * fast/css/is-specificity-6.html: Removed. * fast/css/matches-specificity-6-expected.html: Removed. * fast/css/matches-specificity-6.html: Removed. * fast/css/parsing-css-allowed-string-characters-expected.txt: * fast/css/parsing-css-is-1-expected.txt: * fast/css/parsing-css-is-1.html: * fast/css/parsing-css-is-2-expected.txt: * fast/css/parsing-css-is-2.html: * fast/css/parsing-css-is-3-expected.txt: * fast/css/parsing-css-is-3.html: * fast/css/parsing-css-is-4-expected.txt: * fast/css/parsing-css-is-4.html: * fast/css/parsing-css-matches-1-expected.txt: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2-expected.txt: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3-expected.txt: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4-expected.txt: * fast/css/parsing-css-matches-4.html: * fast/selectors/pseudo-element-in-is-where-expected.html: Added. * fast/selectors/pseudo-element-in-is-where.html: Added. * fast/selectors/pseudo-element-inside-is-expected.html: Removed. * fast/selectors/pseudo-element-inside-is.html: Removed. * fast/selectors/pseudo-element-inside-matches-expected.html: Removed. * fast/selectors/pseudo-element-inside-matches.html: Removed. * fast/selectors/querySelector-is-expected.txt: * fast/selectors/querySelector-is.html: * fast/selectors/querySelector-matches-expected.txt: * fast/selectors/querySelector-matches.html: Canonical link: https://commits.webkit.org/223598@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-19 17:51:19 +00:00
<div class=test2></div>
Implement <forgiving-selector-list> for :is/:where https://bugs.webkit.org/show_bug.cgi?id=217814 <rdar://problem/70384483> Reviewed by Sam Weinig. LayoutTests/imported/w3c: * web-platform-tests/css/selectors/is-where-error-recovery-expected.txt: * web-platform-tests/css/selectors/is-where-not-expected.txt: Source/WebCore: The spec now says :is/:where should parse as a forgiving selector list: https://drafts.csswg.org/selectors/#matches * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::isValidCSSSelector): * css/CSSPageRule.cpp: (WebCore::CSSPageRule::setSelectorText): * css/CSSSelectorList.h: (WebCore::CSSSelectorList::isEmpty const): (WebCore::CSSSelectorList::isValid const): Deleted. An empty CSSSelectorList is now valid. Represent invalid CSSSelectorList with Optional where needed. * css/CSSStyleRule.cpp: (WebCore::CSSStyleRule::setSelectorText): * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseSelector): * css/parser/CSSParser.h: * css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::consumePageRule): (WebCore::CSSParserImpl::consumeStyleRule): * css/parser/CSSSelectorParser.cpp: (WebCore::parseCSSSelector): (WebCore::CSSSelectorParser::consumeComplexSelectorList): (WebCore::CSSSelectorParser::consumeComplexForgivingSelectorList): Add function for consuming <forgiving-selector-list>. (WebCore::CSSSelectorParser::consumePseudo): Use it for :is/:where. * css/parser/CSSSelectorParser.h: * dom/SelectorQuery.cpp: * inspector/InspectorStyleSheet.cpp: (WebCore::isValidSelectorListString): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::highlightSelector): * style/RuleSet.cpp: (WebCore::Style::RuleSet::addStyleRule): LayoutTests: Update some selector parsing tests to log the results instead of PASS/FAIL as forgiving parsing allows many combinations involving :is/:where. Remove a few repetetive tests that don't add anything. * fast/css/parsing-css-attribute-case-insensitive-value-4-expected.txt: Removed. * fast/css/parsing-css-attribute-case-insensitive-value-4.html: Removed. * fast/css/parsing-css-is-5-expected.txt: * fast/css/parsing-css-is-5.html: * fast/css/parsing-css-is-6-expected.txt: * fast/css/parsing-css-is-6.html: * fast/css/parsing-css-is-7-expected.txt: * fast/css/parsing-css-is-7.html: * fast/css/parsing-css-is-8-expected.txt: * fast/css/parsing-css-is-8.html: * fast/css/parsing-css-matches-5-expected.txt: Removed. * fast/css/parsing-css-matches-5.html: Removed. * fast/css/parsing-css-matches-6-expected.txt: Removed. * fast/css/parsing-css-matches-6.html: Removed. * fast/css/parsing-css-matches-7-expected.txt: Removed. * fast/css/parsing-css-matches-7.html: Removed. * fast/css/parsing-css-matches-8-expected.txt: Removed. * fast/css/parsing-css-matches-8.html: Removed. * fast/css/parsing-css-not-5-expected.txt: * fast/css/parsing-css-not-5.html: * fast/css/parsing-css-not-6-expected.txt: * fast/css/parsing-css-not-6.html: * fast/css/parsing-css-not-7-expected.txt: * fast/css/parsing-css-not-7.html: * fast/css/parsing-css-not-8-expected.txt: * fast/css/parsing-css-not-8.html: * fast/css/parsing-css-not-9-expected.txt: * fast/css/parsing-css-not-9.html: * fast/css/parsing-css-nth-child-of-4-expected.txt: * fast/css/parsing-css-nth-child-of-4.html: * fast/css/parsing-css-nth-last-child-of-4-expected.txt: * fast/css/parsing-css-nth-last-child-of-4.html: * fast/selectors/invalid-functional-pseudo-class-expected.txt: * fast/selectors/invalid-functional-pseudo-class.html: * fast/selectors/pseudo-element-in-is-where-expected.html: * fast/selectors/pseudo-element-in-is-where.html: Canonical link: https://commits.webkit.org/230692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268741 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-20 17:07:25 +00:00
<div class=test3>Test that a pseudo element is ignored in :where()</div>
[CSS selectors] :is() / :where() should not allow pseudo-elements at parse-time https://bugs.webkit.org/show_bug.cgi?id=210701 Reviewed by Anders Carlsson. Source/WebCore: https://drafts.csswg.org/selectors/#matches: "Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is()." Test: fast/selectors/pseudo-element-in-is-where.html * css/parser/CSSSelectorParser.cpp: (WebCore::CSSSelectorParser::consumePseudo): LayoutTests: Remove or update tests for pseudo elements inside :is()/:where(). Also add some :where() rountrip coverage. * fast/css/css-selector-text-expected.txt: * fast/css/css-selector-text.html: * fast/css/css-set-selector-text-expected.txt: * fast/css/css-set-selector-text.html: * fast/css/is-specificity-6-expected.html: Removed. * fast/css/is-specificity-6.html: Removed. * fast/css/matches-specificity-6-expected.html: Removed. * fast/css/matches-specificity-6.html: Removed. * fast/css/parsing-css-allowed-string-characters-expected.txt: * fast/css/parsing-css-is-1-expected.txt: * fast/css/parsing-css-is-1.html: * fast/css/parsing-css-is-2-expected.txt: * fast/css/parsing-css-is-2.html: * fast/css/parsing-css-is-3-expected.txt: * fast/css/parsing-css-is-3.html: * fast/css/parsing-css-is-4-expected.txt: * fast/css/parsing-css-is-4.html: * fast/css/parsing-css-matches-1-expected.txt: * fast/css/parsing-css-matches-1.html: * fast/css/parsing-css-matches-2-expected.txt: * fast/css/parsing-css-matches-2.html: * fast/css/parsing-css-matches-3-expected.txt: * fast/css/parsing-css-matches-3.html: * fast/css/parsing-css-matches-4-expected.txt: * fast/css/parsing-css-matches-4.html: * fast/selectors/pseudo-element-in-is-where-expected.html: Added. * fast/selectors/pseudo-element-in-is-where.html: Added. * fast/selectors/pseudo-element-inside-is-expected.html: Removed. * fast/selectors/pseudo-element-inside-is.html: Removed. * fast/selectors/pseudo-element-inside-matches-expected.html: Removed. * fast/selectors/pseudo-element-inside-matches.html: Removed. * fast/selectors/querySelector-is-expected.txt: * fast/selectors/querySelector-is.html: * fast/selectors/querySelector-matches-expected.txt: * fast/selectors/querySelector-matches.html: Canonical link: https://commits.webkit.org/223598@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-19 17:51:19 +00:00
<div class=test4></div>