Truly independent web browser
LibWeb: Import SVG fill currentcolor computed-style coverage
Andreas Kling9359fc0a56ab
diff --git a/Tests/LibWeb/Text/expected/svg-paint-computed-currentcolor.txt b/Tests/LibWeb/Text/expected/svg-paint-computed-currentcolor.txtnew file mode 100644index 00000000000..7ac572a0ec7--- /dev/null+++ b/Tests/LibWeb/Text/expected/svg-paint-computed-currentcolor.txt@@ -0,0 +1,28 @@+block fill: currentcolor+block inherited fill: currentcolor+block changed color fill: currentcolor+block fallback fill: url("#gradient") currentcolor+block fill rgb(from currentcolor r g b): false+block fill color-mix(in srgb, currentcolor, white): false+block none fill: none+block stroke: currentcolor+block inherited stroke: currentcolor+block changed color stroke: currentcolor+block fallback stroke: url("#gradient") currentcolor+block stroke rgb(from currentcolor r g b): false+block stroke color-mix(in srgb, currentcolor, white): false+block none stroke: none+none fill: currentcolor+none inherited fill: currentcolor+none changed color fill: currentcolor+none fallback fill: url("#gradient") currentcolor+none fill rgb(from currentcolor r g b): false+none fill color-mix(in srgb, currentcolor, white): false+none none fill: none+none stroke: currentcolor+none inherited stroke: currentcolor+none changed color stroke: currentcolor+none fallback stroke: url("#gradient") currentcolor+none stroke rgb(from currentcolor r g b): false+none stroke color-mix(in srgb, currentcolor, white): false+none none stroke: nonediff --git a/Tests/LibWeb/Text/expected/wpt-import/svg/pservers/scripted/svg-fill-currentcolor-visited-getcomputedstyle.txt b/Tests/LibWeb/Text/expected/wpt-import/svg/pservers/scripted/svg-fill-currentcolor-visited-getcomputedstyle.txtnew file mode 100644index 00000000000..70d205139ba--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/svg/pservers/scripted/svg-fill-currentcolor-visited-getcomputedstyle.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail Property fill value 'currentColor' should not leak :visited for SVG fill with currentColor\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/svg-paint-computed-currentcolor.html b/Tests/LibWeb/Text/input/svg-paint-computed-currentcolor.htmlnew file mode 100644index 00000000000..e51f042ace0--- /dev/null+++ b/Tests/LibWeb/Text/input/svg-paint-computed-currentcolor.html@@ -0,0 +1,36 @@+<!DOCTYPE html>+<script src="include.js"></script>+<div id="reference"></div>+<svg width="100" height="100">+ <g id="parent" style="color: red"><rect id="child" width="10" height="10" style="color: blue"/></g>+</svg>+<script>+ test(() => {+ const parent = document.getElementById("parent");+ const child = document.getElementById("child");+ const reference = document.getElementById("reference");+ for (const display of ["block", "none"]) {+ parent.style.display = display;+ child.getBoundingClientRect();+ for (const property of ["fill", "stroke"]) {+ child.style.color = "blue";+ parent.style[property] = "currentcolor";+ println(`${display} ${property}: ${getComputedStyle(parent)[property]}`);+ println(`${display} inherited ${property}: ${getComputedStyle(child)[property]}`);+ child.style.color = "green";+ println(`${display} changed color ${property}: ${getComputedStyle(child)[property]}`);+ parent.style[property] = 'url("#gradient") currentcolor';+ println(`${display} fallback ${property}: ${getComputedStyle(child)[property]}`);+ for (const color of ["rgb(from currentcolor r g b)", "color-mix(in srgb, currentcolor, white)"]) {+ parent.style[property] = color;+ reference.style.color = getComputedStyle(child).color;+ reference.style.backgroundColor = color;+ reference.getBoundingClientRect();+ println(`${display} ${property} ${color}: ${getComputedStyle(child)[property] === getComputedStyle(reference).backgroundColor}`);+ }+ parent.style[property] = "none";+ println(`${display} none ${property}: ${getComputedStyle(child)[property]}`);+ }+ }+ });+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/svg/pservers/scripted/svg-fill-currentcolor-visited-getcomputedstyle.html b/Tests/LibWeb/Text/input/wpt-import/svg/pservers/scripted/svg-fill-currentcolor-visited-getcomputedstyle.htmlnew file mode 100644index 00000000000..23c1191e58d--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/svg/pservers/scripted/svg-fill-currentcolor-visited-getcomputedstyle.html@@ -0,0 +1,21 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>SVG paint servers with :visited don't leak information via getComputedStyle</title>+<link rel="help" href="https://www.w3.org/TR/css-color-4/#currentcolor-color">+<link rel="help" href="https://www.w3.org/TR/SVG2/painting.html#SpecifyingFillPaint">+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<script src="../../../css/support/computed-testcommon.js"></script>+<style>+a:link { color: red; }+a:visited { color: green; }+</style>++<a href="">+ <svg width="100" height="100">+ <rect id="target" width="100%" height="100%" fill="currentColor"/>+ </svg>+</a>+<script>+test_computed_value("fill", "currentColor", "rgb(255, 0, 0)", "should not leak :visited for SVG fill with currentColor");+</script>