Closed doctortheemh closed 1 month ago
It looks like we don't support rgb()
values that aren't separated by commas. We also don't appear to support the / 50%
syntax to determine the alpha value.
The following renders correctly in Ladybird:
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<title>Canvas experiment</title>
</head>
<body>
<canvas id="canvas" width="150" height="150"></canvas>
<script type="application/javascript">
function draw() {
const canvas = document.getElementById("canvas");
if (canvas.getContext) {
const ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb(200, 0, 0)";
ctx.fillRect(10, 10, 50, 50);
ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
ctx.fillRect(30, 30, 50, 50);
}
}
draw();
</script>
</body>
</html>
The tutorial for basic canvas usage has a sample that is rendered incorrectly. It lacks all color! The squares should be red and a transparent blue, but we're getting only black.
Tracked things down to
CanvasFillStrokeStyles.h:31
which has a FIXME and some debug info.