Files
ladybird/Tests/LibWeb/Text/input/css/gradient-position-serialization.html
Callum Law acc8b90549 LibWeb: Improve gradient position serialization
`EdgeStyleValues` which consist of an offset of a `calc()`s which
resolves to 50% should be considered "centered" for
`SerializationMode::ResolvedValue` for the purpose of omitting the
position value from gradient serialization.
2026-01-02 11:43:10 +01:00

47 lines
1.1 KiB
HTML

<!DOCTYPE html>
<style>
#a {
background-image: radial-gradient(at center center, red, blue);
}
#b {
background-image: radial-gradient(at 50% 50%, red, blue);
}
#c {
background-image: radial-gradient(at left 50% top 50%, red, blue);
}
#d {
background-image: radial-gradient(at right 50% bottom 50%, red, blue);
}
#e {
background-image: radial-gradient(at calc(50%) calc(50%), red, blue);
}
#f {
background-image: radial-gradient(at calc(sign(1em - 1px) * 50%) calc(sign(1em - 1px) * 50%), red, blue);
}
</style>
<div id="a"></div>
<div id="b"></div>
<div id="c"></div>
<div id="d"></div>
<div id="e"></div>
<div id="f"></div>
<script src="../include.js"></script>
<script>
test(() => {
for (const rule of document.styleSheets[0].cssRules) {
println(rule.cssText);
}
println("Computed:");
for (const el of [a, b, c, d, e, f]) {
println(`#${el.id}: ${getComputedStyle(el).backgroundImage}`);
}
});
</script>