Truly independent web browser
LibWeb: Apply the UA style sheet’s link rules to HTML only
sideshowbarker40ebe9331b67
diff --git a/Libraries/LibWeb/CSS/Default.css b/Libraries/LibWeb/CSS/Default.cssindex 02871057964..da716c35d51 100644--- a/Libraries/LibWeb/CSS/Default.css+++ b/Libraries/LibWeb/CSS/Default.css@@ -436,19 +436,19 @@ rt {display: ruby-text;}-:link {+html|*:link {color: LinkText;}-:visited {+html|*:visited {color: VisitedText;}-:link:active, :visited:active {+html|*:link:active, html|*:visited:active {color: ActiveText;}-:link, :visited {+html|*:link, html|*:visited {text-decoration: underline;cursor: pointer;}diff --git a/Libraries/LibWeb/MathML/Default.css b/Libraries/LibWeb/MathML/Default.cssindex 1672d7f7da6..af442d72eae 100644--- a/Libraries/LibWeb/MathML/Default.css+++ b/Libraries/LibWeb/MathML/Default.css@@ -33,8 +33,16 @@ math[display="inline" i] {math-style: compact;}-/* AD-HOC: Do not underline links, matching other engines. */+/* AD-HOC: Color links as links, but do not underline them, matching other engines.+ * See https://github.com/w3c/mathml-core/issues/128 */+a:link {+ color: LinkText;+}+a:visited {+ color: VisitedText;+}a:any-link {+ cursor: pointer;text-decoration: none;}diff --git a/Tests/LibWeb/Text/expected/SVG/text-hit-test-by-character-cells.txt b/Tests/LibWeb/Text/expected/SVG/text-hit-test-by-character-cells.txtindex ba1eb41f910..22c2ace02ca 100644--- a/Tests/LibWeb/Text/expected/SVG/text-hit-test-by-character-cells.txt+++ b/Tests/LibWeb/Text/expected/SVG/text-hit-test-by-character-cells.txt@@ -5,3 +5,5 @@ above the cells: svgpast the last cell: svgover the text: textover a hidden tspan in the text: svg+SVG link: text-decoration-line none, cursor pointer+HTML link: text-decoration-line underline, cursor pointerdiff --git a/Tests/LibWeb/Text/input/SVG/text-hit-test-by-character-cells.html b/Tests/LibWeb/Text/input/SVG/text-hit-test-by-character-cells.htmlindex da072c62567..33c291e4601 100644--- a/Tests/LibWeb/Text/input/SVG/text-hit-test-by-character-cells.html+++ b/Tests/LibWeb/Text/input/SVG/text-hit-test-by-character-cells.html@@ -15,6 +15,7 @@<svg id="hidden-svg" width="300" height="100" style="font: 40px Ahem"><text x="10" y="50">X<tspan visibility="hidden">XXX</tspan></text></svg>+<p><a id="html-link" href="#target">HTML link</a></p><script>asyncTest(async done => {await document.fonts.ready;@@ -34,6 +35,12 @@const hiddenBox = document.getElementById("hidden-svg").getBoundingClientRect();println(`over the text: ${hit(hiddenBox.left + 30, hiddenBox.top + 30)}`);println(`over a hidden tspan in the text: ${hit(hiddenBox.left + 100, hiddenBox.top + 30)}`);++ // The link rules of the HTML rendering section are for HTML elements only.+ const svgLink = getComputedStyle(document.getElementById("link"));+ const htmlLink = getComputedStyle(document.getElementById("html-link"));+ println(`SVG link: text-decoration-line ${svgLink.textDecorationLine}, cursor ${svgLink.cursor}`);+ println(`HTML link: text-decoration-line ${htmlLink.textDecorationLine}, cursor ${htmlLink.cursor}`);done();});</script>