[Webkit-unassigned] [Bug 245145] New: Sequences of strokes in canvas may stroke with incorrect styles

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 13 09:05:31 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=245145

            Bug ID: 245145
           Summary: Sequences of strokes in canvas may stroke with
                    incorrect styles
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: All
                OS: All
            Status: NEW
          Severity: Major
          Priority: P2
         Component: New Bugs
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jwmerrill at gmail.com

Created attachment 462322

  --> https://bugs.webkit.org/attachment.cgi?id=462322&action=review

Drawing two lines to canvas draws the second line with an incorrect stroke style

In Safari 16, on macOS 12.6 and iOS 16 Beta, certain sequences of stroke calls using the CanvasRenderingContext2D API stroke paths with incorrect properties.

This is a regression compared to Safari 15.

The attached example strokes two single-segment paths. Before the first stroke call, the strokeStyle is set to #f00 (red). Before the second stroke call, the strokeStyle is set to #000 (black). In most browsers, the second path is correctly stroked black, but in Safari 16, both paths are stroked red.

We have experimented with many minor variations of this problem. A few observations:
* strokeStyle is not the only affected property. lineWidth suffers from similar problems, and other properties may be affected too.
* The problem seems to depend on how many points are on the path. We have observed the problem with two point paths (i.e. single straight segments), but not with more complex paths.
* The problem seems to depend on attempting to set drawing context properties back to previously used values. In the attached example, the problem occurs when we attempt to set strokeStyle back to its default value (#000). This update is not applied when the path is stroked, and instead, the previous strokeStyle (#f00) is used.
* The problem seems to be affected by how clearRect calls are interleaved with stroke calls. Writes to strokeStyle or lineWidth (and perhaps other properties) appear not to be applied when they attempt to set a property back to the value it had at the time of the last clearRect call.
* We have reproduced similar problems with no clearRect calls at all, so the problem appears to be influenced by clearRect, but does not depend on clearRect.

We'd be happy to supply additional variations on the attached example if it would be helpful.

The attached example is a reduced test case based on bugs reported to Desmos by iOS 16 Beta users using the Desmos Graphing Calculator (https://www.desmos.com/calculator). This bug report was jointly prepared by Jason Merrill and Julia Proft.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220913/e93db244/attachment-0001.htm>


More information about the webkit-unassigned mailing list