RESOLVED FIXED 259772
SVG rect with rx or ry set to zero is drawn incorrectly
https://bugs.webkit.org/show_bug.cgi?id=259772
Summary SVG rect with rx or ry set to zero is drawn incorrectly
kari.pihkala
Reported 2023-08-03 03:17:14 PDT
Created attachment 467192 [details] rect-rxry.svg Safari renders SVG <rect> elements with rx set to a value and ry set to a zero value with rounded corners. They should be drawn without rounded corners. The same happens if ry is set to a value and rx is set to a zero value. The attached test case rect-rxry.svg ( fiddle: https://jsfiddle.net/d82x3nvs/ ) should have two rectangles drawn without rounded corners. Safari draws them with rounded corners. Tested on Safari 16.5.2 (18615.2.9.11.10) and Safari Tech Preview Release 174 (Safari 17.0, WebKit 18616.1.22.1). Firefox 115 and Chrome 115 render the test case correctly without rounded corners. Safari 5.1.7 (7534.57.7) used to render the rectangles correctly without rounded corners. Rendering got broken some time after it and at least Safari 10.1.2 (12603.3.8) is drawing them incorrectly.
Attachments
rect-rxry.svg (359 bytes, image/svg+xml)
2023-08-03 03:17 PDT, kari.pihkala
no flags
Radar WebKit Bug Importer
Comment 1 2023-08-04 07:33:17 PDT
Said Abou-Hallawa
Comment 2 2023-08-04 09:33:15 PDT
One easy fix is to replace the following condition in LegacyRenderSVGRect::updateShapeFromElement() and RenderSVGRect::updateShapeFromElement() if (rectElement().rx().value(lengthContext) > 0 || rectElement().ry().value(lengthContext) > 0 || hasNonScalingStroke()) { // Fall back to LegacyRenderSVGShape LegacyRenderSVGShape::updateShapeFromElement(); return; } by if ((rectElement().rx().value(lengthContext) > 0 && rectElement().ry().value(lengthContext) > 0) || hasNonScalingStroke()) { // Fall back to LegacyRenderSVGShape LegacyRenderSVGShape::updateShapeFromElement(); return; }
Said Abou-Hallawa
Comment 3 2023-08-04 17:52:08 PDT
EWS
Comment 4 2023-08-07 10:55:45 PDT
Committed 266641@main (3dc74d79ceb7): <https://commits.webkit.org/266641@main> Reviewed commits have been landed. Closing PR #16414 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.