rect zero radius handling not conformant
Migrated from https://bugs.launchpad.net/inkscape/+bug/1533302
Steps to reproduce:
What happened?
- Corners are rounded
What should have happened?
- Corners should be sharp, because rx is explicitly set to 0.
From the launchpad issue (note they say Chrome matches Inkscape but current Chromium displays it sharp)
The SVG spec says that if a properly specified value is not supplied for one radius, both radii are set to the other value. Inkscape appears to be applying that here, but I believe this is incorrect as 0 is a properly specified value. If any radius is zero then a degenerate ellipse is produced which should result in square corners.
I have attached a very simple example that has a element with the rx attribute explicitly set to 0 and a non-zero ry attribute. Inkscape (and Chrome, Safari, and IE 11) renders the shape with rounded corners. Firefox renders it correctly with square corners.
- SVG 1.1 Specs: https://www.w3.org/TR/SVG11/shapes.html#RectElement
- Similar rules in SVG 2 Specs: https://www.w3.org/TR/SVG2/shapes.html#RectElement
Tentative patch by @shlomif inkscape-bug1533302-tentative-patch.patch
(irc excerpt)
21:21 < Mc> nah
21:22 < Mc> you're changing the intended behavior
21:22 < Mc> you're basically reverting the fix to https://bugs.launchpad.net/inkscape/+bug/481805 :)
21:23 < Mc> ( http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/12255 )
21:28 < rindolf> Mc: why can't an rx or ry be 0?
21:29 < Mc> basically, when you drag the round handles in rect mode, setting it "to 0" (to the corner) is the UI way of disabling it
21:30 < Mc> and 0, in SVG, means that the corners are sharp, whatever the other handle says, while you'd want an easy UI way to set a circle (not ellipse) corner and setting rx=0, ry!=0 is basically useless
21:31 < Mc> so, rx or ry "can" be 0, but if so, then you'd want a way to preserve current UI behavior anyway, one way or another
So a fix to this should also preserve the rectangle tool behavior when dragging the rectangle rx handle to 0.
Version info
- Inkscape 1.3-dev (7108662a0e, 2022-04-25) Linux Mint 20
- Inkscape 0.91 r13725 on Mac OS X 10.10.5