Open Bug 1763747 Opened 4 years ago Updated 2 years ago

Path2D(string) should use the broken path until the first error

Categories

(Core :: Graphics: Canvas2D, defect)

Firefox 101
defect

Tracking

()

ASSIGNED

People

(Reporter: tristan.fraipont, Assigned: nical)

Details

Attachments

(2 files)

Attached file test-case.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0

Steps to reproduce:

Create a new Path2D from an SVG path data string containing an error (e.g M10 10L20 20 30, the 30 is an error).
Then try to draw that Path2D object on a 2D context.

Actual results:

Nothing is drawn.

Expected results:

According to the HTML specs, the path data should be parsed and interpreted by following the rules of SVG 2, which state that "the SVG user agent shall render a ‘path’ element up to (but not including) the path command containing the first error in the path data specification".
So we should have had the first MoveTo 0 0 and LineTo 10 10 honored.

Firefox does respect this rule for SVG <path>. Safari and Chrome do too for both SVG and Path2D.

This is NOT a regression. Running bisect against old builds still reproduced the issue.

On a side note, I couldn't find a single WPT testing Path2D(string)...

Severity: -- → S4
Flags: needinfo?(nical.bugzilla)
Assignee: nobody → nical.bugzilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(nical.bugzilla)

There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:nical, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(nical.bugzilla)
Flags: needinfo?(bwerth)

I want to look into adding a test when time allows.

Flags: needinfo?(nical.bugzilla)
Flags: needinfo?(bwerth)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: