mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 16:46:08 +00:00
LibWeb+LibGfx: Serialize HTML canvas fill/strokeStyle colors correctly
Before this change we were serializing them in a bogus 8-digit hex color format that isn't actually recognized by HTML. This code will need more work when we start supporting color spaces other than sRGB.
This commit is contained in:
parent
f4648f7551
commit
4590c081c2
Notes:
github-actions[bot]
2024-10-04 18:02:27 +00:00
Author: https://github.com/awesomekling
Commit: 4590c081c2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1629
7 changed files with 58 additions and 9 deletions
18
Tests/LibWeb/Text/input/canvas/fillStyle-serialization.html
Normal file
18
Tests/LibWeb/Text/input/canvas/fillStyle-serialization.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<script src="../include.js"></script>
|
||||
<canvas id="c" width=300 height=300></canvas>
|
||||
<script>
|
||||
test(() => {
|
||||
let x = c.getContext("2d");
|
||||
|
||||
function go(color) {
|
||||
x.fillStyle = color;
|
||||
println("`" + color + "` -> `" + x.fillStyle + "`");
|
||||
}
|
||||
|
||||
go("green");
|
||||
go("rgba(128, 128, 128, 0.4)");
|
||||
go("rgba(128, 128, 128, 0)");
|
||||
go("rgba(128, 128, 128, 1)");
|
||||
go("rgb(128, 128, 128)");
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue