WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
309035
rounding issue for svg rect height with em and percentage
https://bugs.webkit.org/show_bug.cgi?id=309035
Summary
rounding issue for svg rect height with em and percentage
Karl Dubost
Reported
2026-03-02 20:56:52 PST
http://wpt.live/svg/geometry/svg-baseval-in-display-none.html
https://wpt.fyi/results/svg/geometry/svg-baseval-in-display-none.html
https://codepen.io/webcompat/pen/ogzjVyQ?editors=1010
<svg width="0" height="0"> <svg width="600" height="400" font-size="5"> <symbol width="40em" height="20em"> <g font-size="10px"> <rect id="r1" x="5em" y="6em" width="20%" height="30%"></rect> <circle id="c1" cx="5em" cy="6em" r="10em"></circle> </g> </symbol> <g font-size="10px" style="display:none"> <rect id="r2" x="5em" y="6em" width="20%" height="30%"></rect> <circle id="c2" cx="5em" cy="6em" r="10em"></circle> </g> </svg> </svg> Test Results: SAFARI r1.width = 120 (120) r1.height = 120.00000762939453 (120) r2.width = 120 (120) r2.height = 120.00000762939453 (120) CHROME/FIREFOX r1.width = 120 (120) r1.height = 120 (120) r2.width = 120 (120) r2.height = 120 (120)
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2026-03-02 20:57:41 PST
<
rdar://problem/171587382
>
Karl Dubost
Comment 2
2026-03-17 00:56:38 PDT
The fact that this is failing only for height is pure luck. Width has the same issue. We should probably modify the tests that it is able to fail in the same way for width. The float parameter in convertValueFromPercentageToUserUnits(float value, ...) truncates the double result of value / 100.0 before multiplying by the viewport dimension. The fix needs to keep the computation in double precision through the multiplication, only casting to float at the end.
Karl Dubost
Comment 3
2026-03-17 00:58:15 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/60750
EWS
Comment 4
2026-05-26 19:18:20 PDT
Committed
313935@main
(5ed9fc92e49b): <
https://commits.webkit.org/313935@main
> Reviewed commits have been landed. Closing PR #60750 and removing active labels.
Karl Dubost
Comment 5
2026-05-26 19:35:55 PDT
Submitted web-platform-tests pull request:
https://github.com/web-platform-tests/wpt/pull/60194
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug