Changeset 285032 in webkit
- Timestamp:
- Oct 29, 2021 9:22:04 AM (9 months ago)
- Location:
- trunk
- Files:
-
- 11 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css/pseudo-any-expected.txt (modified) (1 diff)
-
LayoutTests/fast/css/pseudo-any.html (modified) (4 diffs)
-
LayoutTests/fast/dom/SelectorAPI/not-supported-namespace-in-selector-expected.txt (modified) (1 diff)
-
LayoutTests/fast/dom/SelectorAPI/not-supported-namespace-in-selector.html (modified) (1 diff)
-
LayoutTests/fast/selectors/invalid-functional-pseudo-class-expected.txt (modified) (2 diffs)
-
LayoutTests/fast/selectors/invalid-functional-pseudo-class.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/SelectorChecker.cpp (modified) (2 diffs)
-
Source/WebCore/css/parser/CSSSelectorParser.cpp (modified) (2 diffs)
-
Source/WebCore/cssjit/SelectorCompiler.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r285030 r285032 1 2021-10-29 Antti Koivisto <antti@apple.com> 2 3 Make :-webkit-any() a synonym of :is() 4 https://bugs.webkit.org/show_bug.cgi?id=232482 5 6 Reviewed by Simon Fraser. 7 8 * fast/css/pseudo-any-expected.txt: 9 * fast/css/pseudo-any.html: 10 * fast/dom/SelectorAPI/not-supported-namespace-in-selector-expected.txt: 11 * fast/dom/SelectorAPI/not-supported-namespace-in-selector.html: 12 * fast/selectors/invalid-functional-pseudo-class-expected.txt: 13 * fast/selectors/invalid-functional-pseudo-class.html: 14 1 15 2021-10-29 Ayumi Kojima <ayumi_kojima@apple.com> 2 16 -
trunk/LayoutTests/fast/css/pseudo-any-expected.txt
r82183 r285032 76 76 77 77 s 78 PASS document.defaultView.getComputedStyle(element, null).getPropertyValue('background-color') is 'rgb a(0, 0, 0, 0)'78 PASS document.defaultView.getComputedStyle(element, null).getPropertyValue('background-color') is 'rgb(0, 0, 255)' 79 79 80 80 div span -
trunk/LayoutTests/fast/css/pseudo-any.html
r155263 r285032 22 22 23 23 :-webkit-any(s,:nonexistentpseudo) { 24 background-color: red;24 background-color: blue; 25 25 } 26 26 27 27 div~q { 28 background-color: blue;28 background-color: red; 29 29 } 30 30 :-webkit-any(div ~ q) { … … 32 32 } 33 33 :-webkit-any(div~q) { 34 background-color: red;34 background-color: blue; 35 35 } 36 36 37 37 q+q { 38 background-color: blue;38 background-color: red; 39 39 } 40 40 :-webkit-any(q+q) { 41 background-color: red;41 background-color: blue; 42 42 } 43 43 44 44 q>span { 45 background-color: blue;45 background-color: red; 46 46 } 47 47 :-webkit-any(q>span) { 48 background-color: red;48 background-color: blue; 49 49 } 50 50 … … 56 56 } 57 57 :-webkit-any( div span ) { 58 background-color: red;58 background-color: blue; 59 59 } 60 60 </style> … … 153 153 assertWhite("#container-div a[name]"); 154 154 155 assert White("s");155 assertBlue("s"); 156 156 assertBlue("div span"); 157 157 assertBlue("div ~ q"); -
trunk/LayoutTests/fast/dom/SelectorAPI/not-supported-namespace-in-selector-expected.txt
r219663 r285032 37 37 PASS: document.body.matches('[|name=value]') did not throw 38 38 PASS: document.body.webkitMatchesSelector('[|name=value]') did not throw 39 PASS: document.querySelector(':-webkit-any(bbb|pre)') throws: SyntaxError: The string did not match the expected pattern.39 PASS: document.querySelector(':-webkit-any(bbb|pre)') did not throw 40 40 PASS: document.querySelector('div [bbb|name=value]') throws: SyntaxError: The string did not match the expected pattern. 41 41 PASS: document.querySelectorAll('div [bbb|name=value]') throws: SyntaxError: The string did not match the expected pattern. -
trunk/LayoutTests/fast/dom/SelectorAPI/not-supported-namespace-in-selector.html
r167631 r285032 71 71 shouldNotThrow("document.body.webkitMatchesSelector('[|name=value]')"); 72 72 73 should Throw("document.querySelector(':-webkit-any(bbb|pre)')");73 shouldNotThrow("document.querySelector(':-webkit-any(bbb|pre)')"); 74 74 75 75 shouldThrow("document.querySelector('div [bbb|name=value]')"); -
trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class-expected.txt
r268741 r285032 8 8 PASS document.querySelectorAll(":-webkit-any\\\").length threw exception SyntaxError: Unexpected EOF. 9 9 PASS document.querySelectorAll(":-webkit-any\\\\").length threw exception SyntaxError: The string did not match the expected pattern.. 10 PASS document.querySelectorAll(":-webkit-any\(").length threw exception SyntaxError: The string did not match the expected pattern..10 PASS document.querySelectorAll(":-webkit-any\(").length did not throw exception. 11 11 PASS document.querySelectorAll(":-webkit-any\\(").length threw exception SyntaxError: The string did not match the expected pattern.. 12 12 PASS document.querySelectorAll(":-webkit-any\\\(").length threw exception SyntaxError: The string did not match the expected pattern.. … … 19 19 PASS document.querySelectorAll(":-webkit-any\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern.. 20 20 PASS document.querySelectorAll(":-webkit-any\\\\( .foo").length threw exception SyntaxError: The string did not match the expected pattern.. 21 PASS document.querySelectorAll(":-webkit-any\()").length threw exception SyntaxError: The string did not match the expected pattern..21 PASS document.querySelectorAll(":-webkit-any\()").length did not throw exception. 22 22 PASS document.querySelectorAll(":-webkit-any\\()").length threw exception SyntaxError: The string did not match the expected pattern.. 23 23 PASS document.querySelectorAll(":-webkit-any\\\()").length threw exception SyntaxError: The string did not match the expected pattern.. -
trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class.html
r268741 r285032 39 39 40 40 function testQuerySelector(functonalPseudoClassName) { 41 for (var testCase of invalidRules(functonalPseudoClassName)) 41 for (var testCase of invalidRules(functonalPseudoClassName)) { 42 if (testCase == ':-webkit-any\\()' || testCase == ':-webkit-any\\(') { 43 shouldNotThrow('document.querySelectorAll("' + testCase + '").length'); 44 continue; 45 } 42 46 shouldThrow('document.querySelectorAll("' + testCase + '").length'); 47 } 43 48 } 44 49 -
trunk/Source/WebCore/ChangeLog
r285030 r285032 1 2021-10-29 Antti Koivisto <antti@apple.com> 2 3 Make :-webkit-any() a synonym of :is() 4 https://bugs.webkit.org/show_bug.cgi?id=232482 5 6 Reviewed by Simon Fraser. 7 8 :-webkit-any() is an obscure obsolete subset version of the standard :is(). It can become a full synonym. 9 Another obsolete version :matches() is already a full synonym. 10 11 The main difference is that :is allows complex selectors and uses forgiving parsing. 12 13 * css/SelectorChecker.cpp: 14 (WebCore::SelectorChecker::checkOne const): 15 * css/parser/CSSSelectorParser.cpp: 16 (WebCore::CSSSelectorParser::consumePseudo): 17 * cssjit/SelectorCompiler.cpp: 18 (WebCore::SelectorCompiler::addPseudoClassType): 19 1 20 2021-10-29 Ayumi Kojima <ayumi_kojima@apple.com> 2 21 -
trunk/Source/WebCore/css/SelectorChecker.cpp
r284973 r285032 816 816 } 817 817 case CSSSelector::PseudoClassIs: 818 case CSSSelector::PseudoClassWhere: 818 819 case CSSSelector::PseudoClassMatches: 819 case CSSSelector::PseudoClass Where:820 case CSSSelector::PseudoClassAny: 820 821 { 821 822 bool hasMatchedAnything = false; … … 966 967 if (&element == element.document().cssTarget()) 967 968 return true; 968 break;969 case CSSSelector::PseudoClassAny:970 {971 LocalContext subcontext(context);972 subcontext.inFunctionalPseudoClass = true;973 subcontext.pseudoElementEffective = false;974 for (subcontext.selector = selector.selectorList()->first(); subcontext.selector; subcontext.selector = CSSSelectorList::next(subcontext.selector)) {975 subcontext.firstSelectorOfTheFragment = subcontext.selector;976 PseudoIdSet ignoreDynamicPseudo;977 if (matchRecursively(checkingContext, subcontext, ignoreDynamicPseudo).match == Match::SelectorMatches)978 return true;979 }980 }981 969 break; 982 970 case CSSSelector::PseudoClassAutofill: -
trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp
r284973 r285032 743 743 } 744 744 case CSSSelector::PseudoClassIs: 745 case CSSSelector::PseudoClassWhere: 745 746 case CSSSelector::PseudoClassMatches: 746 case CSSSelector::PseudoClass Where: {747 case CSSSelector::PseudoClassAny: { 747 748 SetForScope<bool> resistDefaultNamespace(m_resistDefaultNamespace, true); 748 749 DisallowPseudoElementsScope scope(*this); … … 754 755 return selector; 755 756 } 756 case CSSSelector::PseudoClassAny:757 757 case CSSSelector::PseudoClassHost: { 758 758 auto selectorList = makeUnique<CSSSelectorList>(); -
trunk/Source/WebCore/cssjit/SelectorCompiler.cpp
r284973 r285032 1066 1066 return functionType; 1067 1067 } 1068 1069 case CSSSelector::PseudoClassAny:1070 {1071 Vector<SelectorFragment, 32> anyFragments;1072 FunctionType functionType = FunctionType::SimpleSelectorChecker;1073 for (const CSSSelector* rootSelector = selector.selectorList()->first(); rootSelector; rootSelector = CSSSelectorList::next(rootSelector)) {1074 SelectorFragmentList fragmentList;1075 VisitedMode ignoreVisitedMode = VisitedMode::None;1076 FunctionType subFunctionType = constructFragments(rootSelector, selectorContext, fragmentList, FragmentsLevel::InFunctionalPseudoType, positionInRootFragments, visitedMatchEnabled, ignoreVisitedMode, PseudoElementMatchingBehavior::NeverMatch);1077 ASSERT_WITH_MESSAGE(ignoreVisitedMode == VisitedMode::None, ":visited is disabled in the functional pseudo classes");1078 1079 // Since this fragment always unmatch against the element, don't insert it to anyFragments.1080 if (subFunctionType == FunctionType::CannotMatchAnything)1081 continue;1082 1083 if (subFunctionType == FunctionType::CannotCompile)1084 return FunctionType::CannotCompile;1085 1086 // :any() may not contain complex selectors which have combinators.1087 ASSERT(fragmentList.size() == 1);1088 if (fragmentList.size() != 1)1089 return FunctionType::CannotCompile;1090 1091 const SelectorFragment& subFragment = fragmentList.first();1092 anyFragments.append(subFragment);1093 functionType = mostRestrictiveFunctionType(functionType, subFunctionType);1094 }1095 1096 // Since all fragments in :any() cannot match anything, this :any() filter cannot match anything.1097 if (anyFragments.isEmpty())1098 return FunctionType::CannotMatchAnything;1099 1100 ASSERT(!anyFragments.isEmpty());1101 fragment.anyFilters.append(anyFragments);1102 1103 return functionType;1104 }1105 1106 1068 case CSSSelector::PseudoClassLang: 1107 1069 { … … 1113 1075 1114 1076 case CSSSelector::PseudoClassIs: 1077 case CSSSelector::PseudoClassWhere: 1115 1078 case CSSSelector::PseudoClassMatches: 1116 case CSSSelector::PseudoClass Where:1079 case CSSSelector::PseudoClassAny: 1117 1080 { 1118 1081 SelectorList matchesList;
Note: See TracChangeset
for help on using the changeset viewer.