Bug 245420

Summary: Safari 16 fails to correctly apply strokeStyle to canvas paths
Product: WebKit Reporter: Paul Neave <paul.neave>
Component: CanvasAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Major CC: dino
Priority: P2    
Version: Safari Technology Preview   
Hardware: All   
OS: iOS 16   
Attachments:
Description Flags
Demo HTML/JS none

Description Paul Neave 2022-09-20 04:07:30 PDT
Created attachment 462469 [details]
Demo HTML/JS

Major bug in Safari 16 (iOS and macOS) when drawing paths with strokeStyle in 2D canvas. 

The demo code below draws three small lines. One red, one blue, and the last one red.

In Safari 16, the third line is incorrectly colored blue.

```
<html>
<body>
<canvas id="canvas"></canvas>
<script>

const canvas = document.getElementById('canvas');
const context = canvas.getContext('2d');

context.lineWidth = 6;

context.beginPath();
context.strokeStyle = 'red';
context.moveTo(30, 50);
context.lineTo(50, 50);
context.stroke();

context.beginPath();
context.strokeStyle = 'blue';
context.moveTo(60, 50);
context.lineTo(80, 50);
context.stroke();

context.beginPath();
context.strokeStyle = 'red';
context.moveTo(90, 50);
context.lineTo(110, 50);
context.stroke();

</script>
</body>
</html>

```

In all other browsers, including previous versions of Safari, the strokeStyle color is adhered to on a third call. In Safari 16, it does not update the color and it stays on the previous color.
Comment 1 Alexey Proskuryakov 2022-09-20 18:36:49 PDT

*** This bug has been marked as a duplicate of bug 245145 ***