[svgwg] Rect decomposition is invalid (#753)

tatarize has just created a new issue for https://github.com/w3c/svgwg:

== Rect decomposition is invalid ==
https://www.w3.org/TR/SVG/shapes.html#RectElement

According to the spec, if rx, and ry are 0 the path is not closed.

1. perform an absolute moveto operation to location (x+rx,y);
2. perform an absolute horizontal lineto with parameter x+width-rx;
3. if both rx and ry are greater than zero, perform an absolute elliptical arc operation to coordinate (x+width,y+ry), where rx and ry are used as the equivalent parameters to the elliptical arc command, the x-axis-rotation and large-arc-flag are set to zero, the sweep-flag is set to one;
4. perform an absolute vertical lineto parameter y+height-ry;
5. if both rx and ry are greater than zero, perform an absolute elliptical arc operation to coordinate (x+width-rx,y+height), using the same parameters as previously;
6. perform an absolute horizontal lineto parameter x+rx;
7. if both rx and ry are greater than zero, perform an absolute elliptical arc operation to coordinate (x,y+height-ry), using the same parameters as previously;
8. perform an absolute vertical lineto parameter y+ry
9. if both rx and ry are greater than zero, perform an absolute elliptical arc operation with a segment-completing close path operation, using the same parameters as previously.

The issue is that 9 is using the segment-completing close path operation. But, if `rx == ry == 0` and 9 does not apply there is no instruction that the path is closed. When we are dealing with a rectangle where `rx==ry==0` the resulting instructions without the conditional arcs is:

1. perform an absolute moveto operation to location (x+rx,y);
2. perform an absolute horizontal lineto with parameter x+width-rx;
4. perform an absolute vertical lineto parameter y+height-ry;
6. perform an absolute horizontal lineto parameter x+rx;
8. perform an absolute vertical lineto parameter y+ry

This is an open path.

Please view or discuss this issue at https://github.com/w3c/svgwg/issues/753 using your GitHub account

Received on Wednesday, 20 November 2019 15:51:59 UTC