Diff
Modified: trunk/LayoutTests/ChangeLog (279817 => 279818)
--- trunk/LayoutTests/ChangeLog 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/ChangeLog 2021-07-12 04:08:46 UTC (rev 279818)
@@ -1,3 +1,21 @@
+2021-07-11 Chris Dumez <[email protected]>
+
+ :link and :visited pseudo-class selectors should not match <link> elements
+ https://bugs.webkit.org/show_bug.cgi?id=227847
+
+ Reviewed by Sam Weinig.
+
+ Update / Rebaseline existing tests due to behavior change.
+
+ * fast/css/link-basics-expected.html:
+ * fast/css/link-basics.html:
+ * fast/selectors/any-link-basics-expected.txt:
+ * fast/selectors/link-basics-expected.txt:
+ * fast/selectors/link-basics-xhtml-expected.txt:
+ * fast/selectors/resources/html-link-type-tests.js:
+ (testHTMLTagsForLink):
+ * fast/selectors/webkit-any-link-basics-expected.txt:
+
2021-07-11 Fujii Hironori <[email protected]>
[WinCairo] Unreviewed test gardening
Modified: trunk/LayoutTests/fast/css/link-basics-expected.html (279817 => 279818)
--- trunk/LayoutTests/fast/css/link-basics-expected.html 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/fast/css/link-basics-expected.html 2021-07-12 04:08:46 UTC (rev 279818)
@@ -17,7 +17,6 @@
<body>
<p>Test styling with the :link selector. Any type the text is <em>GREEN</em>, its color should be green.</p>
<p><a>WebKit</a> <a style="color:lime" href="" ">GREEN</a> <a style="color:lime" href=""
- <p><link class="webkit"> <link class="green" style="color:lime" href="" "> <link class="green" style="color:lime" href=""
<p><area class="webkit"> <area class="green" style="color:lime" href="" "> <area class="green" style="color:lime" href=""
</body>
</html>
Modified: trunk/LayoutTests/fast/css/link-basics.html (279817 => 279818)
--- trunk/LayoutTests/fast/css/link-basics.html 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/fast/css/link-basics.html 2021-07-12 04:08:46 UTC (rev 279818)
@@ -20,7 +20,6 @@
<body>
<p>Test styling with the :link selector. Any type the text is <em>GREEN</em>, its color should be green.</p>
<p><a>WebKit</a> <a href="" ">GREEN</a> <a href=""
- <p><link> <link href="" "> <link href=""
<p><area> <area href="" "> <area href=""
</body>
</html>
Modified: trunk/LayoutTests/fast/selectors/any-link-basics-expected.txt (279817 => 279818)
--- trunk/LayoutTests/fast/selectors/any-link-basics-expected.txt 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/fast/selectors/any-link-basics-expected.txt 2021-07-12 04:08:46 UTC (rev 279818)
@@ -1159,12 +1159,6 @@
PASS document.getElementById("target").matches(":any-link") is false
PASS document.querySelectorAll("#target:any-link").length is 0
PASS document.querySelectorAll(".target:any-link").length is 0
-PASS document.getElementById("target").matches(":any-link") is true
-PASS document.querySelectorAll("#target:any-link").length is 1
-PASS document.querySelectorAll(".target:any-link").length is 1
-PASS document.getElementById("target").matches(":any-link") is true
-PASS document.querySelectorAll("#target:any-link").length is 1
-PASS document.querySelectorAll(".target:any-link").length is 1
PASS document.getElementById("target").matches(":any-link") is false
PASS document.querySelectorAll("#target:any-link").length is 0
PASS document.querySelectorAll(".target:any-link").length is 0
@@ -1171,6 +1165,12 @@
PASS document.getElementById("target").matches(":any-link") is false
PASS document.querySelectorAll("#target:any-link").length is 0
PASS document.querySelectorAll(".target:any-link").length is 0
+PASS document.getElementById("target").matches(":any-link") is false
+PASS document.querySelectorAll("#target:any-link").length is 0
+PASS document.querySelectorAll(".target:any-link").length is 0
+PASS document.getElementById("target").matches(":any-link") is false
+PASS document.querySelectorAll("#target:any-link").length is 0
+PASS document.querySelectorAll(".target:any-link").length is 0
Testing listing
PASS document.getElementById("target").matches(":any-link") is false
PASS document.querySelectorAll("#target:any-link").length is 0
Modified: trunk/LayoutTests/fast/selectors/link-basics-expected.txt (279817 => 279818)
--- trunk/LayoutTests/fast/selectors/link-basics-expected.txt 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/fast/selectors/link-basics-expected.txt 2021-07-12 04:08:46 UTC (rev 279818)
@@ -1159,12 +1159,6 @@
PASS document.getElementById("target").matches(":link") is false
PASS document.querySelectorAll("#target:link").length is 0
PASS document.querySelectorAll(".target:link").length is 0
-PASS document.getElementById("target").matches(":link") is true
-PASS document.querySelectorAll("#target:link").length is 1
-PASS document.querySelectorAll(".target:link").length is 1
-PASS document.getElementById("target").matches(":link") is true
-PASS document.querySelectorAll("#target:link").length is 1
-PASS document.querySelectorAll(".target:link").length is 1
PASS document.getElementById("target").matches(":link") is false
PASS document.querySelectorAll("#target:link").length is 0
PASS document.querySelectorAll(".target:link").length is 0
@@ -1171,6 +1165,12 @@
PASS document.getElementById("target").matches(":link") is false
PASS document.querySelectorAll("#target:link").length is 0
PASS document.querySelectorAll(".target:link").length is 0
+PASS document.getElementById("target").matches(":link") is false
+PASS document.querySelectorAll("#target:link").length is 0
+PASS document.querySelectorAll(".target:link").length is 0
+PASS document.getElementById("target").matches(":link") is false
+PASS document.querySelectorAll("#target:link").length is 0
+PASS document.querySelectorAll(".target:link").length is 0
Testing listing
PASS document.getElementById("target").matches(":link") is false
PASS document.querySelectorAll("#target:link").length is 0
Modified: trunk/LayoutTests/fast/selectors/link-basics-xhtml-expected.txt (279817 => 279818)
--- trunk/LayoutTests/fast/selectors/link-basics-xhtml-expected.txt 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/fast/selectors/link-basics-xhtml-expected.txt 2021-07-12 04:08:46 UTC (rev 279818)
@@ -1159,12 +1159,6 @@
PASS document.getElementById("target").matches(":link") is false
PASS document.querySelectorAll("#target:link").length is 0
PASS document.querySelectorAll(".target:link").length is 0
-PASS document.getElementById("target").matches(":link") is true
-PASS document.querySelectorAll("#target:link").length is 1
-PASS document.querySelectorAll(".target:link").length is 1
-PASS document.getElementById("target").matches(":link") is true
-PASS document.querySelectorAll("#target:link").length is 1
-PASS document.querySelectorAll(".target:link").length is 1
PASS document.getElementById("target").matches(":link") is false
PASS document.querySelectorAll("#target:link").length is 0
PASS document.querySelectorAll(".target:link").length is 0
@@ -1171,6 +1165,12 @@
PASS document.getElementById("target").matches(":link") is false
PASS document.querySelectorAll("#target:link").length is 0
PASS document.querySelectorAll(".target:link").length is 0
+PASS document.getElementById("target").matches(":link") is false
+PASS document.querySelectorAll("#target:link").length is 0
+PASS document.querySelectorAll(".target:link").length is 0
+PASS document.getElementById("target").matches(":link") is false
+PASS document.querySelectorAll("#target:link").length is 0
+PASS document.querySelectorAll(".target:link").length is 0
Testing listing
PASS document.getElementById("target").matches(":link") is false
PASS document.querySelectorAll("#target:link").length is 0
Modified: trunk/LayoutTests/fast/selectors/resources/html-link-type-tests.js (279817 => 279818)
--- trunk/LayoutTests/fast/selectors/resources/html-link-type-tests.js 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/fast/selectors/resources/html-link-type-tests.js 2021-07-12 04:08:46 UTC (rev 279818)
@@ -40,7 +40,7 @@
function testHTMLTagsForLink(selector) {
for (var i = 0; i < htmlTags.length; ++i) {
var tag = htmlTags[i];
- var shouldMatch = tag === 'a' || tag === 'area' || tag === 'link';
+ var shouldMatch = tag === 'a' || tag === 'area';
testHTMLElement(tag, selector, shouldMatch);
}
-}
\ No newline at end of file
+}
Modified: trunk/LayoutTests/fast/selectors/webkit-any-link-basics-expected.txt (279817 => 279818)
--- trunk/LayoutTests/fast/selectors/webkit-any-link-basics-expected.txt 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/fast/selectors/webkit-any-link-basics-expected.txt 2021-07-12 04:08:46 UTC (rev 279818)
@@ -1159,12 +1159,6 @@
PASS document.getElementById("target").matches(":-webkit-any-link") is false
PASS document.querySelectorAll("#target:-webkit-any-link").length is 0
PASS document.querySelectorAll(".target:-webkit-any-link").length is 0
-PASS document.getElementById("target").matches(":-webkit-any-link") is true
-PASS document.querySelectorAll("#target:-webkit-any-link").length is 1
-PASS document.querySelectorAll(".target:-webkit-any-link").length is 1
-PASS document.getElementById("target").matches(":-webkit-any-link") is true
-PASS document.querySelectorAll("#target:-webkit-any-link").length is 1
-PASS document.querySelectorAll(".target:-webkit-any-link").length is 1
PASS document.getElementById("target").matches(":-webkit-any-link") is false
PASS document.querySelectorAll("#target:-webkit-any-link").length is 0
PASS document.querySelectorAll(".target:-webkit-any-link").length is 0
@@ -1171,6 +1165,12 @@
PASS document.getElementById("target").matches(":-webkit-any-link") is false
PASS document.querySelectorAll("#target:-webkit-any-link").length is 0
PASS document.querySelectorAll(".target:-webkit-any-link").length is 0
+PASS document.getElementById("target").matches(":-webkit-any-link") is false
+PASS document.querySelectorAll("#target:-webkit-any-link").length is 0
+PASS document.querySelectorAll(".target:-webkit-any-link").length is 0
+PASS document.getElementById("target").matches(":-webkit-any-link") is false
+PASS document.querySelectorAll("#target:-webkit-any-link").length is 0
+PASS document.querySelectorAll(".target:-webkit-any-link").length is 0
Testing listing
PASS document.getElementById("target").matches(":-webkit-any-link") is false
PASS document.querySelectorAll("#target:-webkit-any-link").length is 0
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (279817 => 279818)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-12 04:08:46 UTC (rev 279818)
@@ -1,5 +1,18 @@
2021-07-11 Chris Dumez <[email protected]>
+ :link and :visited pseudo-class selectors should not match <link> elements
+ https://bugs.webkit.org/show_bug.cgi?id=227847
+
+ Reviewed by Sam Weinig.
+
+ Rebaseline WPT tests now that more checks are passing.
+
+ * web-platform-tests/dom/nodes/ParentNode-querySelector-All-expected.txt:
+ * web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht-expected.txt:
+ * web-platform-tests/html/semantics/selectors/pseudo-classes/link-expected.txt:
+
+2021-07-11 Chris Dumez <[email protected]>
+
XMLSerializer.serializeToString() doesn't properly escape \n, \n and \t
https://bugs.webkit.org/show_bug.cgi?id=227844
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-expected.txt (279817 => 279818)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-expected.txt 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-expected.txt 2021-07-12 04:08:46 UTC (rev 279818)
@@ -595,8 +595,8 @@
PASS Document.querySelector: :empty pseudo-class selector, matching all empty elements: #pseudo-empty :empty
PASS Document.querySelectorAll: :link and :visited pseudo-class selectors, matching a and area elements with href attributes: #pseudo-link :link, #pseudo-link :visited
PASS Document.querySelector: :link and :visited pseudo-class selectors, matching a and area elements with href attributes: #pseudo-link :link, #pseudo-link :visited
-FAIL Document.querySelectorAll: :link and :visited pseudo-class selectors, matching no elements: #head :link, #head :visited assert_equals: The method should return the expected number of matches. expected 0 but got 2
-FAIL Document.querySelector: :link and :visited pseudo-class selectors, matching no elements: #head :link, #head :visited assert_equals: The method should not match anything. expected null but got Element node <link id="pseudo-link-link1" href=""
+PASS Document.querySelectorAll: :link and :visited pseudo-class selectors, matching no elements: #head :link, #head :visited
+PASS Document.querySelector: :link and :visited pseudo-class selectors, matching no elements: #head :link, #head :visited
PASS Document.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target
PASS Document.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target
PASS Document.querySelectorAll: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht-expected.txt (279817 => 279818)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht-expected.txt 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-querySelector-All-xht-expected.txt 2021-07-12 04:08:46 UTC (rev 279818)
@@ -595,8 +595,8 @@
PASS Document.querySelector: :empty pseudo-class selector, matching all empty elements: #pseudo-empty :empty
PASS Document.querySelectorAll: :link and :visited pseudo-class selectors, matching a and area elements with href attributes: #pseudo-link :link, #pseudo-link :visited
PASS Document.querySelector: :link and :visited pseudo-class selectors, matching a and area elements with href attributes: #pseudo-link :link, #pseudo-link :visited
-FAIL Document.querySelectorAll: :link and :visited pseudo-class selectors, matching no elements: #head :link, #head :visited assert_equals: The method should return the expected number of matches. expected 0 but got 2
-FAIL Document.querySelector: :link and :visited pseudo-class selectors, matching no elements: #head :link, #head :visited assert_equals: The method should not match anything. expected null but got Element node <link id="pseudo-link-link1" href=""
+PASS Document.querySelectorAll: :link and :visited pseudo-class selectors, matching no elements: #head :link, #head :visited
+PASS Document.querySelector: :link and :visited pseudo-class selectors, matching no elements: #head :link, #head :visited
PASS Document.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target
PASS Document.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target
PASS Document.querySelectorAll: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/link-expected.txt (279817 => 279818)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/link-expected.txt 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/link-expected.txt 2021-07-12 04:08:46 UTC (rev 279818)
@@ -1,3 +1,3 @@
-FAIL Only <a>s and <area>s that have a href attribute match ':link' assert_array_equals: lengths differ, expected array [Element node <a href="" id="link7"></a>, Element node <area href="" id="link8"></area>, Element node <a href="" id="link10"></a>] length 3, got [Element node <link rel="author" title="Denis Ah-Kang" href="" Element node <link rel="help" href="" Element node <link rel="stylesheet" href="" id="link3"..., Element node <a href="" id="link7"></a>, Element node <area href="" id="link8"></area>, Element node <link href="" id="link9"&g
t;</link>, Element node <a href="" id="link10"></a>] length 7
+PASS Only <a>s and <area>s that have a href attribute match ':link'
Modified: trunk/Source/WebCore/ChangeLog (279817 => 279818)
--- trunk/Source/WebCore/ChangeLog 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/Source/WebCore/ChangeLog 2021-07-12 04:08:46 UTC (rev 279818)
@@ -1,5 +1,23 @@
2021-07-11 Chris Dumez <[email protected]>
+ :link and :visited pseudo-class selectors should not match <link> elements
+ https://bugs.webkit.org/show_bug.cgi?id=227847
+
+ Reviewed by Sam Weinig.
+
+ :link, :visited and :any-link should only match <a> and <area> elements as per:
+ - https://drafts.csswg.org/selectors/#the-any-link-pseudo
+
+ Blink and Gecko match the specification. However, WebKit was incorrectly matching
+ <link> elements too.
+
+ No new tests, rebaselined existing tests.
+
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::parseAttribute):
+
+2021-07-11 Chris Dumez <[email protected]>
+
XMLSerializer.serializeToString() doesn't properly escape \n, \n and \t
https://bugs.webkit.org/show_bug.cgi?id=227844
Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (279817 => 279818)
--- trunk/Source/WebCore/html/HTMLLinkElement.cpp 2021-07-11 23:41:03 UTC (rev 279817)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp 2021-07-12 04:08:46 UTC (rev 279818)
@@ -171,10 +171,6 @@
return;
}
if (name == hrefAttr) {
- bool wasLink = isLink();
- setIsLink(!value.isNull() && !shouldProhibitLinks(this));
- if (wasLink != isLink())
- invalidateStyleForSubtree();
process();
return;
}