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

Remove the step "Prune all zero-length line segments from path" in path Tracing #9663

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yiyix
Copy link
Contributor

@yiyix yiyix commented Aug 31, 2023

This is a longstanding issue. The expected rendering behaviour of Subpaths of length 0 is different in SVG and Canvas, where linecaps are rendered in SVG and removed in Canvas2D. As discussed in the issue, it seems that people are generally agreed that canvas2d and svg should follow a common rendering mode.

I prepared this draft to help to reach consensus.


/canvas.html ( diff )

@annevk
Copy link
Member

annevk commented Aug 31, 2023

For a change of this nature you'll need to fill out the pull request template. Perhaps you created this PR via CLI and therefore omitted it? You can find it at https://github.com/whatwg/html/blob/main/PULL_REQUEST_TEMPLATE.md.

@annevk
Copy link
Member

annevk commented Aug 31, 2023

cc @whatwg/canvas

@Kaiido
Copy link
Member

Kaiido commented Sep 13, 2023

Should probably be noted that it won't be as easy as just removing this step.
The current texts expect zero length subpaths only from the dash line algorithm. From there the directionality of the segment could be derived from the original path that has been cutted out. From true zero length segments though there is no directionality that can be derived. We thus need to import all the rules from SVG2: https://svgwg.org/svg2-draft/paths.html#PathDirectionality
Similarly, caps on closed zero length paths would not be drawn according to the resulting PR, both points are converted to joins, no cap. In SVG they do draw it. https://svgwg.org/svg2-draft/painting.html#LineCaps

If a subpath, whether open or closed, has zero length, then the resulting effect is that the stroke for that subpath consists solely of ...

And finally, I'm not sure the tests would just need to be "inverted", I think this change will require new tests.

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

Successfully merging this pull request may close these issues.

3 participants