Bug 309035
| Summary: | rounding issue for svg rect height with em and percentage | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Karl Dubost <karlcow> |
| Component: | SVG | Assignee: | Karl Dubost <karlcow> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | sabouhallawa, webkit-bug-importer, zimmermann |
| Priority: | P2 | Keywords: | InRadar, WPTImpact |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://wpt.live/svg/geometry/svg-baseval-in-display-none.html | ||
| See Also: | https://github.com/web-platform-tests/wpt/pull/60194 | ||
Karl Dubost
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
<rdar://problem/171587382>
Karl Dubost
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
Pull request: https://github.com/WebKit/WebKit/pull/60750
EWS
Committed 313935@main (5ed9fc92e49b): <https://commits.webkit.org/313935@main>
Reviewed commits have been landed. Closing PR #60750 and removing active labels.
Karl Dubost
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/60194