Bug 255997 - Rect child element of an SVG renders with an incorrect size
Summary: Rect child element of an SVG renders with an incorrect size
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: Safari 16
Hardware: Mac (Apple Silicon) macOS 13
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-04-26 10:48 PDT by romain
Modified: 2023-05-03 10:49 PDT (History)
5 users (show)

See Also:


Attachments
A screen recording of the SVG being rotated, illustrating that the rect child element isn't fully square. (93.56 KB, video/mp4)
2023-04-26 10:48 PDT, romain
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description romain 2023-04-26 10:48:05 PDT
Created attachment 466103 [details]
A screen recording of the SVG being rotated, illustrating that the rect child element isn't fully square.

I've noticed that SVG child elements render inconsistently depending on some surrounding factors.
I've tried to illustrate this in a reproduction :

https://github.com/romainmenke/safari-svg-display-grid-bug-0001

This document renders correctly in all browsers :
https://romainmenke.github.io/safari-svg-display-grid-bug-0001/svg-without-text.html

The SVG element is 16px by 16px and the rect child element also is 16px by 16px.

This document however renders differently in Safari : 
https://romainmenke.github.io/safari-svg-display-grid-bug-0001/svg-after-text.html

The SVG element is 16px by 16px BUT the rect child element is now 17px by 16px.
Even worse, when rotating the element the side that isn't correctly sized seems to shift.

I've added a hover transition to rotate the element.
A screen recording of the shift can be found here : https://github.com/romainmenke/safari-svg-display-grid-bug-0001
I've also attached that screen recording here.

The only difference between these documents is that one has some plain text before the SVG.
There are multiple ways to trigger this state, but this was the most simple reproduction.
Comment 1 Radar WebKit Bug Importer 2023-05-03 10:49:22 PDT
<rdar://problem/108848690>