Diff
Modified: trunk/LayoutTests/ChangeLog (260318 => 260319)
--- trunk/LayoutTests/ChangeLog 2020-04-18 17:17:12 UTC (rev 260318)
+++ trunk/LayoutTests/ChangeLog 2020-04-18 20:24:31 UTC (rev 260319)
@@ -1,3 +1,13 @@
+2020-04-18 Antti Koivisto <[email protected]>
+
+ [CSS selectors] Support :where() pseudo class
+ https://bugs.webkit.org/show_bug.cgi?id=210690
+
+ Reviewed by Sam Weinig.
+
+ * fast/selectors/where-specificity-expected.html: Added.
+ * fast/selectors/where-specificity.html: Added.
+
2020-04-17 Simon Fraser <[email protected]>
Group overflow controls layers into a single container layer
Added: trunk/LayoutTests/fast/selectors/where-specificity-expected.html (0 => 260319)
--- trunk/LayoutTests/fast/selectors/where-specificity-expected.html (rev 0)
+++ trunk/LayoutTests/fast/selectors/where-specificity-expected.html 2020-04-18 20:24:31 UTC (rev 260319)
@@ -0,0 +1,24 @@
+<!doctype html>
+<style>
+.case { color: black; background-color: green }
+</style>
+
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
+<div class=case>Black on green</div>
Added: trunk/LayoutTests/fast/selectors/where-specificity.html (0 => 260319)
--- trunk/LayoutTests/fast/selectors/where-specificity.html (rev 0)
+++ trunk/LayoutTests/fast/selectors/where-specificity.html 2020-04-18 20:24:31 UTC (rev 260319)
@@ -0,0 +1,60 @@
+<!doctype html>
+<style>
+test { display: block; }
+
+.case1 :where(#test) { color: red; background-color: green; }
+.case1 #test { color: black; }
+.case2 :where(.test) { color: red; background-color: green; }
+.case2 .test { color: black; }
+.case3 :where(test) { color: red; background-color: green; }
+.case3 test { color: black; }
+.case4 :where(#other, div .test) { color: red; background-color: green; }
+.case4 .test { color: black; }
+
+.case5 #test { color: black; }
+.case5 :where(#test) { color: red; background-color: green; }
+.case6 .test { color: black; }
+.case6 :where(.test) { color: red; background-color: green; }
+.case7 test { color: black; }
+.case7 :where(test) { color: red; background-color: green; }
+.case8 .test { color: black; }
+.case8 :where(#other, div .test) { color: red; background-color: green; }
+
+.case9 #test:where(#test) { color: red; background-color: green; }
+.case9 #test { color: black; }
+.case10 .test:where(.test) { color: red; background-color: green; }
+.case10 .test { color: black; }
+.case11 test:where(test) { color: red; background-color: green; }
+.case11 test { color: black; }
+div.case12 .test:where(#other, div .test) { color: red; background-color: green; }
+div.case12 .test { color: black; }
+
+.case13 #test { color: red; }
+.case13 #test:where(#test) { color: black; background-color: green; }
+.case14 .test { color: red; }
+.case14 .test:where(.test) { color: black; background-color: green; }
+.case15 test { color: red; }
+.case15 test:where(test) { color: black; background-color: green; }
+div.case16 .test { color: red; }
+div.case16 .test:where(#other, div .test) { color: black; background-color: green; }
+</style>
+
+<div class=case1><div id=test>Black on green</div></div>
+<div class=case2><div class=test>Black on green</div></div>
+<div class=case3><test>Black on green</test></div>
+<div class=case4><div class=test>Black on green</div></div>
+
+<div class=case5><div id=test>Black on green</div></div>
+<div class=case6><div class=test>Black on green</div></div>
+<div class=case7><test>Black on green</test></div>
+<div class=case8><div class=test>Black on green</div></div>
+
+<div class=case9><div id=test>Black on green</div></div>
+<div class=case10><div class=test>Black on green</div></div>
+<div class=case11><test>Black on green</test></div>
+<div class=case12><div class=test>Black on green</div></div>
+
+<div class=case13><div id=test>Black on green</div></div>
+<div class=case14><div class=test>Black on green</div></div>
+<div class=case15><test>Black on green</test></div>
+<div class=case16><div class=test>Black on green</div></div>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (260318 => 260319)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-04-18 17:17:12 UTC (rev 260318)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-04-18 20:24:31 UTC (rev 260319)
@@ -1,3 +1,12 @@
+2020-04-18 Antti Koivisto <[email protected]>
+
+ [CSS selectors] Support :where() pseudo class
+ https://bugs.webkit.org/show_bug.cgi?id=210690
+
+ Reviewed by Sam Weinig.
+
+ * web-platform-tests/css/selectors/invalidation/where-expected.txt:
+
2020-04-17 Jason Lawrence <[email protected]>
REGRESSION: (r260243) [ Mac and iOS ] imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent.html fails.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/where-expected.txt (260318 => 260319)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/where-expected.txt 2020-04-18 17:17:12 UTC (rev 260318)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/selectors/invalidation/where-expected.txt 2020-04-18 20:24:31 UTC (rev 260319)
@@ -5,9 +5,9 @@
Red
Yellow
-FAIL Preconditions. assert_equals: expected "rgb(255, 0, 0)" but got "rgb(0, 0, 0)"
-FAIL Invalidate :where() for simple selector arguments. assert_equals: expected "rgb(255, 0, 0)" but got "rgb(0, 0, 0)"
-FAIL Invalidate :where() for compound selector arguments. assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
-FAIL Invalidate :where() for complex selector arguments. assert_equals: expected "rgb(255, 255, 0)" but got "rgb(0, 0, 0)"
-FAIL Invalidate nested :where(). assert_equals: expected "rgb(0, 0, 255)" but got "rgb(0, 0, 0)"
+PASS Preconditions.
+PASS Invalidate :where() for simple selector arguments.
+PASS Invalidate :where() for compound selector arguments.
+PASS Invalidate :where() for complex selector arguments.
+PASS Invalidate nested :where().
Modified: trunk/Source/WebCore/ChangeLog (260318 => 260319)
--- trunk/Source/WebCore/ChangeLog 2020-04-18 17:17:12 UTC (rev 260318)
+++ trunk/Source/WebCore/ChangeLog 2020-04-18 20:24:31 UTC (rev 260319)
@@ -1,3 +1,39 @@
+2020-04-18 Antti Koivisto <[email protected]>
+
+ [CSS selectors] Support :where() pseudo class
+ https://bugs.webkit.org/show_bug.cgi?id=210690
+
+ Reviewed by Sam Weinig.
+
+ "The Specificity-adjustment pseudo-class, :where(), is a functional pseudo-class with the same
+ syntax and functionality as :is(). Unlike :is(), neither the :where pseudo-class, nor any of
+ its arguments contribute to the specificity of the selector—its specificity is always zero.
+
+ This is useful for introducing filters in a selector while keeping the associated style
+ declarations easy to override."
+
+ https://drafts.csswg.org/selectors-4/#zero-matches
+
+ In terms of implementation this is just another alias for :is() with different (always 0) specificity.
+
+ Test: fast/selectors/where-specificity.html
+
+ * css/CSSSelector.cpp:
+ (WebCore::simpleSelectorSpecificityInternal):
+
+ Here is where it differs from PseudoClassIs.
+
+ (WebCore::CSSSelector::selectorText const):
+ * css/CSSSelector.h:
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::checkOne const):
+ * css/SelectorPseudoClassAndCompatibilityElementMap.in:
+ * css/parser/CSSSelectorParser.cpp:
+ (WebCore::isOnlyPseudoClassFunction):
+ (WebCore::CSSSelectorParser::consumePseudo):
+ * cssjit/SelectorCompiler.cpp:
+ (WebCore::SelectorCompiler::addPseudoClassType):
+
2020-04-18 Rob Buis <[email protected]>
Reduce parameter list of the FrameLoadRequest constructor
Modified: trunk/Source/WebCore/css/CSSSelector.cpp (260318 => 260319)
--- trunk/Source/WebCore/css/CSSSelector.cpp 2020-04-18 17:17:12 UTC (rev 260318)
+++ trunk/Source/WebCore/css/CSSSelector.cpp 2020-04-18 20:24:31 UTC (rev 260319)
@@ -124,6 +124,8 @@
case CSSSelector::PseudoClassMatches:
case CSSSelector::PseudoClassNot:
return maxSpecificity(*simpleSelector.selectorList());
+ case CSSSelector::PseudoClassWhere:
+ return 0;
case CSSSelector::PseudoClassNthChild:
case CSSSelector::PseudoClassNthLastChild:
return CSSSelector::addSpecificities(static_cast<unsigned>(SelectorSpecificityIncrement::ClassB), simpleSelector.selectorList() ? maxSpecificity(*simpleSelector.selectorList()) : 0);
@@ -605,6 +607,12 @@
builder.append(')');
break;
}
+ case CSSSelector::PseudoClassWhere: {
+ builder.appendLiteral(":where(");
+ cs->selectorList()->buildSelectorsText(builder);
+ builder.append(')');
+ break;
+ }
case CSSSelector::PseudoClassPlaceholderShown:
builder.appendLiteral(":placeholder-shown");
break;
Modified: trunk/Source/WebCore/css/CSSSelector.h (260318 => 260319)
--- trunk/Source/WebCore/css/CSSSelector.h 2020-04-18 17:17:12 UTC (rev 260318)
+++ trunk/Source/WebCore/css/CSSSelector.h 2020-04-18 20:24:31 UTC (rev 260319)
@@ -123,6 +123,7 @@
PseudoClassDisabled,
PseudoClassIs,
PseudoClassMatches, // obsolete synonym for PseudoClassIs
+ PseudoClassWhere,
PseudoClassOptional,
PseudoClassPlaceholderShown,
PseudoClassRequired,
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (260318 => 260319)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2020-04-18 17:17:12 UTC (rev 260318)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2020-04-18 20:24:31 UTC (rev 260319)
@@ -798,6 +798,7 @@
}
case CSSSelector::PseudoClassIs:
case CSSSelector::PseudoClassMatches:
+ case CSSSelector::PseudoClassWhere:
{
bool hasMatchedAnything = false;
Modified: trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in (260318 => 260319)
--- trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in 2020-04-18 17:17:12 UTC (rev 260318)
+++ trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in 2020-04-18 20:24:31 UTC (rev 260319)
@@ -71,6 +71,7 @@
valid
vertical
visited
+where
window-inactive
#if ENABLE(FULLSCREEN_API)
Modified: trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp (260318 => 260319)
--- trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp 2020-04-18 17:17:12 UTC (rev 260318)
+++ trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp 2020-04-18 20:24:31 UTC (rev 260319)
@@ -497,6 +497,7 @@
case CSSSelector::PseudoClassNot:
case CSSSelector::PseudoClassIs:
case CSSSelector::PseudoClassMatches:
+ case CSSSelector::PseudoClassWhere:
case CSSSelector::PseudoClassNthChild:
case CSSSelector::PseudoClassNthLastChild:
case CSSSelector::PseudoClassNthOfType:
@@ -634,7 +635,8 @@
return selector;
}
case CSSSelector::PseudoClassIs:
- case CSSSelector::PseudoClassMatches: {
+ case CSSSelector::PseudoClassMatches:
+ case CSSSelector::PseudoClassWhere: {
auto selectorList = makeUnique<CSSSelectorList>();
*selectorList = consumeComplexSelectorList(block);
if (!selectorList->first() || !block.atEnd())
Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (260318 => 260319)
--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2020-04-18 17:17:12 UTC (rev 260318)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2020-04-18 20:24:31 UTC (rev 260319)
@@ -800,6 +800,7 @@
case CSSSelector::PseudoClassIs:
case CSSSelector::PseudoClassMatches:
+ case CSSSelector::PseudoClassWhere:
{
SelectorList matchesList;
const CSSSelectorList* selectorList = selector.selectorList();