RESOLVED FIXED323707
WPT getBBox tests wrongly expect a zero bbox for a non-rendered ancestor
https://bugs.webkit.org/show_bug.cgi?id=323707
Summary WPT getBBox tests wrongly expect a zero bbox for a non-rendered ancestor
Karl Dubost
Reported 2026-09-08 17:15:30 PDT
TLDR: seven subtests in getBBox-06 and getBBox-07 expect a zero bounding box for a shape whose ancestor is not rendered. SVG 2 says getBBox returns the rectangle the shape would have if it were drawn. Safari is right and is scored as failing. The fix belongs in the tests, not in WebKit. SVG 2 coords.html, Bounding boxes, says two things about a hidden element. First: "A call to getBBox on the element will return the same rectangle as if the element were rendered." Second: "an element that is not in the rendering tree does not contribute to the bounding box of any ancestor element." https://w3c.github.io/svgwg/svg2-draft/coords.html#BoundingBoxes The tests expect zero for the container and for the shape inside it. Only the container is zero. The example table in that same section shows it: defs-1 is {0,0,0,0}, rect-1 is {20,20,40,40}. Measured 2026-09-08, controls green in all four builds. Safari 26.4 and 27.0 are identical, so this does not depend on the build. spec Safari 26.4/27.0 Firefox 157 Chrome 155 symbol1 {0,0,0,0} {0,0,0,0} {0,0,0,0} {50,60,100,150} symbol1_rect {50,60,100,150} {50,60,100,150} {0,0,0,0} {50,60,100,150} defs_rect {10,20,100,50} {10,20,100,50} {0,0,0,0} {10,20,100,50} none_rect {90,100,20,25} {0,0,0,0} {0,0,0,0} {0,0,0,0} g_none, g_none_rect, defs_circle, defs_g_rect, clip_rect and mask_rect all follow the symbol1_rect pattern. So Safari follows both sentences. Firefox follows the second and breaks the first, returning zero for all seven shapes. Chrome follows the first and breaks the second, letting a hidden shape enlarge its container. Chrome's half is a real bug the old tests hid. Each test checked the container and the shape in one subtest, so Safari and Chrome both went red on the same line for different reasons. This patch gives each its own subtest. Safari goes from 7 failures to 0, Chrome from 7 to 2, Firefox from 0 to 7. The comment in getBBox-06 credits the zero to svgwg#1018. That resolution is about a shape whose own width or height is missing or negative. The phrase "non-rendered element" carried over from the sentence the resolution deleted, and every shape in these tests has valid geometry. Left as it is: none_rect, a shape with display:none on itself. coords.html asks for its real rectangle and all three browsers return zero, so that one is a question for the WG rather than something to settle by editing a test. Not this bug: the other 13 getBBox subtests failing in Safari are the SVGBoundingBoxOptions dictionary, bug 227107.
Attachments
Radar WebKit Bug Importer
Comment 1 2026-09-08 17:15:37 PDT
Karl Dubost
Comment 2 2026-09-08 17:51:59 PDT
EWS
Comment 3 2026-09-10 16:32:46 PDT
Committed 320886@main (543ba52c13f9): <https://commits.webkit.org/320886@main> Reviewed commits have been landed. Closing PR #73517 and removing active labels.
Karl Dubost
Comment 4 2026-09-10 16:43:27 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/62615
Note You need to log in before you can comment on or make changes to this bug.