Bug 263387

Summary: [GPU Process] REGRESSION: display-p3 stroke color in canvas crashes the webpage
Product: WebKit Reporter: Starli0n <s_theroude>
Component: CanvasAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Critical CC: dino, sabouhallawa, webkit-bug-importer, webkit-unassigned
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: Mac (Intel)   
OS: macOS 14   
See Also: https://bugs.webkit.org/show_bug.cgi?id=264000

Description Starli0n 2023-10-19 12:20:04 PDT
+++ This bug was initially created as a clone of Bug #263375 +++

In this version of Safari, the bug mentioned above is getting worst.

Instead of having an invisible stroke, it crashes the webpage.

Here is an updated sample, with some comments, to easily reproduce the bug:
(The code needs to be copy/paste)

The aim is to draw two lines with the same color but with a different line width.

// https://www.w3schools.com/jsref/tryit.asp?filename=tryhtml5_canvas_stroke

<!DOCTYPE html>
<html>
<body>
<h1>HTML5 Canvas</h1>
<h2>The stroke() Method</h2>

<canvas id="myCanvas" width="300" height="150" style="border:1px solid grey"></canvas>

<script>
const c = document.getElementById("myCanvas");
const ctx = c.getContext("2d");

ctx.strokeStyle = "color(display-p3 1 0 0 / 1)";
ctx.lineWidth = 1;

ctx.beginPath();
ctx.moveTo(20, 20);
ctx.lineTo(20, 100);
ctx.stroke();

// ctx.strokeStyle = "color(display-p3 0 0 1 / 1)"; // <== Uncomment this, to not have the bug but the color are not the same
ctx.lineWidth = 2;

ctx.beginPath();
// ctx.moveTo(-1, -1); <<== Uncomment this to have a workaround that fulfill the purpose of the code
ctx.moveTo(40, 20);
ctx.lineTo(40, 100);
ctx.stroke(); // <<== It crashes here !!

</script>

</body>
</html>
Comment 1 Radar WebKit Bug Importer 2023-10-19 14:46:55 PDT
<rdar://problem/117226767>
Comment 2 Said Abou-Hallawa 2023-10-20 17:05:39 PDT
Pull request: https://github.com/WebKit/WebKit/pull/19383
Comment 3 EWS 2023-10-23 13:48:01 PDT
Committed 269664@main (922c037bca6e): <https://commits.webkit.org/269664@main>

Reviewed commits have been landed. Closing PR #19383 and removing active labels.
Comment 4 Said Abou-Hallawa 2023-10-27 12:36:31 PDT
Re-opening for pull request https://github.com/apple/WebKit/pull/892
Comment 5 EWS 2023-10-27 18:45:06 PDT
Committed 267815.463@safari-7617-branch (584274dcf192): <https://commits.webkit.org/267815.463@safari-7617-branch>

Reviewed commits have been landed. Closing PR #892 and removing active labels.