| Summary: | REGRESSION (iOS 16): Sequences of strokes in canvas may stroke with incorrect styles | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Jason Merrill <jwmerrill> | ||||
| Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | RESOLVED DUPLICATE | ||||||
| Severity: | Major | CC: | ahmad.saleem792, ap, bfulgham, ccampbell, karlcow, mattwoodrow, paul.neave, realer09, simon.fraser, webkit-bug-importer, zalan | ||||
| Priority: | P1 | Keywords: | BrowserCompat, InRadar | ||||
| Version: | Safari Technology Preview | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Attachments: |
|
||||||
|
Description
Jason Merrill
2022-09-13 09:05:31 PDT
I am able to reproduce this bug in Safari 16 / STP 153 on macOS 12.6 and also on iOS 16 while other browsers like Chrome Canary 107 and Firefox Nightly 106 render horizontal line in ‘black’ color rather than ‘red’. Thanks! Possibly regressed at https://commits.webkit.org/252522@main I believe this bug report accurately describes the graph rendering issues we're seeing in the En-ROADS climate simulator: https://en-roads.climateinteractive.org/scenario.html The issue causes lines to appear with the wrong color (e.g., the "Baseline" plot should always be black, not gray) and/or with the wrong stroke width (hovering over the "Current Scenario" blue plot sometimes causes it to appear thin instead of thick). These issues were not present in Safari 15 or any other browser. Only reproducible in Safari 16.0, Safari 16.1 beta1, and latest Safari Technology Preview (Release 153). FWIW, we use Chart.js (https://github.com/chartjs/Chart.js) v2.9.4 for rendering graphs in En-ROADS. While I don't have a smaller test case that reproduces this outside of En-ROADS/Chart.js, I hope you'll use En-ROADS to verify the fix for this regression. Facing similar issue with Canvas not properly switching between stroke styles and line widths on Safari 16 (both MacOS and iOS). Hope my example helps to debug this issue. https://jsfiddle.net/387t6cem/1/ *** Bug 245420 has been marked as a duplicate of this bug. *** (In reply to Simon Fraser (smfr) from comment #3) > Possibly regressed at https://commits.webkit.org/252522@main Yes it could be that the batch optimizations/caching introduced here is overaggressive and has not been tested for all cases. Until this is fixed, a hacky workaround is to adjust the lineWidth between each stroke to circumvent this 'caching' behavior. For example: ``` 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.lineWidth = 6.001; // Small adjustment here or the next stroke will remain blue context.beginPath(); context.strokeStyle = 'red'; context.moveTo(90, 50); context.lineTo(110, 50); context.stroke(); ``` This workaround won't cover all bug cases. In my example, i'm always changing lineWidth along with strokeStyle, and yet bugs with invalid color or width are reproducible (https://jsfiddle.net/387t6cem/1/) We currently consider this to be a dupe of bug 245465. Sorry for duping to a newer bug, but that one has a PR already posted. *** This bug has been marked as a duplicate of bug 245465 *** |