Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Third parameter of arc in path data should allow signed numbers #750

Open
dalboris opened this issue Nov 18, 2019 · 3 comments
Open

Third parameter of arc in path data should allow signed numbers #750

dalboris opened this issue Nov 18, 2019 · 3 comments

Comments

@dalboris
Copy link

Hi everyone,

As I'm currently writing a parser for SVG path data, I'm able to provide a new pair of eyes for the new grammar definition introduced in SVG 2. Disclaimer: I'm not a grammar specialist, but I did study those things at University a few years back, so hopefully I'm not too rusty.

I am now reasonably familiar with the original SVG 1.1 grammar:

https://www.w3.org/TR/SVG11/paths.html#PathDataBNF

The one currently drafted in:

https://svgwg.org/svg2-draft/paths.html#PathDataBNF

And I have read the following threads to get a sense of the history and rationale of some of the modifications:

#335
#331
#286
#325

Overall, I think the SVG 2 draft grammar reads much better than the SVG 1.1 grammar, thank you for that! I may suggest minor tweaks later to improve readability, but for now a more serious issue. I think the following:

elliptical_arc_argument::=
    number comma_wsp? number comma_wsp? number comma_wsp
    flag comma_wsp? flag comma_wsp? coordinate_pair

should be:

elliptical_arc_argument::=
    number comma_wsp? number comma_wsp? coordinate comma_wsp
    flag comma_wsp? flag comma_wsp? coordinate_pair

In other words, the third parameter of an arc should be coordinate rather than number (it can be negative). The original SVG 1.1 grammar was the following:

elliptical-arc-argument:
    nonnegative-number comma-wsp? nonnegative-number comma-wsp? 
        number comma-wsp flag comma-wsp? flag comma-wsp? coordinate-pair

This seems an unintentional mistake, as I haven't seen this discussed, but maybe I missed it.

Cheers,
Boris

@dalboris
Copy link
Author

(Note that in SVG 1.1 grammar, "number" means "signed number", while in the SVG 2 draft it means "unsigned number", which may have contributed to the confusion)

@AmeliaBR
Copy link
Contributor

The third value of arc represents a rotation angle, so there's no logical reason why it can't be negative. And a quick test in all the browsers I had easy access to shows that they accept it.

So I agree, this was probably an accidental oversight when renaming the grammar syntax tokens.

@dirkschulze
Copy link
Contributor

The bot didn't add the discussion of the SVG WG. Here the link as reference: https://www.w3.org/2019/11/20-svg-minutes.html#item05

The SVG WG confirms that this has been an oversight and should be corrected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants