RESOLVED CONFIGURATION CHANGED200423
Wrong SVG intrinsic width when removing the height attribute and setting the viewBox attribute
https://bugs.webkit.org/show_bug.cgi?id=200423
Summary Wrong SVG intrinsic width when removing the height attribute and setting the ...
Said Abou-Hallawa
Reported 2019-08-03 18:41:43 PDT
Created attachment 375493 [details] test case Open the attached test case. Expected: No alert messages and child <rect> element fills the whole SVG client rect. Result: An alert message is invoked and the intrinsic with of the SVG is wrong. Related WPT test is: https://wpt.fyi/results/svg/coordinate-systems/outer-svg-intrinsic-size-001.html?label=master&label=experimental
Attachments
test case (1.00 KB, text/html)
2019-08-03 18:41 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2019-08-03 18:47:55 PDT
Similarly, the SVG intrinsic height is not calculated correctly if the width attribute is removed and the viewBox attribute is set. Related WPT test is: https://wpt.fyi/results/svg/coordinate-systems/outer-svg-intrinsic-size-002.html?label=master&label=experimental
Karl Dubost
Comment 2 2025-08-14 01:07:53 PDT
With: <svg id="mySVG" viewBox="0 0 40 30" height="60"> let svgElem = document.getElementById("mySVG"); svgElem.getBoundingClientRect().width: 80 svgElem.getBoundingClientRect().height: 60 Then svgElem.setAttribute("viewBox", "0 0 100 120"); so it becomes <svg id="mySVG" style="background-color:gold;" viewBox="0 0 100 120" height="60"></svg> svgElem.getBoundingClientRect().width: 80 <-- WRONG svgElem.getBoundingClientRect().height: 60 instead of svgElem.getBoundingClientRect().width: 50 svgElem.getBoundingClientRect().height: 60
Karl Dubost
Comment 3 2025-08-14 01:15:25 PDT
This is failing in both Legacy and LBSE.
Karl Dubost
Comment 4 2025-08-14 01:18:30 PDT
Ahmad Saleem
Comment 5 2025-11-12 13:46:11 PST
It seems to pass now on Safari 26.2 Beta and matches with Chrome Canary 144.
Note You need to log in before you can comment on or make changes to this bug.