Bug 279714
Summary: | SVG stroke-dasharray does not work with mixed units in calc | ||
---|---|---|---|
Product: | WebKit | Reporter: | Devon Govett <govett> |
Component: | SVG | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | ahmad.saleem792, koivisto, sabouhallawa, simon.fraser, webkit-bug-importer, zalan, zimmermann |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari Technology Preview | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Devon Govett
When setting `stroke-dasharray` to a `calc` with mixed units (e.g. percentage and pixels), WebKit resolves the whole calculation to 0 instead of the correct result. For example, `stroke-dasharray="calc(2 * pi * (50% - 2px))" could be used to create a dash array that goes around the length of a circle. The circle is 50% of the width, minus 2px to account for the stroke width. This works with just `2 * pi * 50%`, and works with `2 * pi * (50px - 2px)` but as soon as percentages and pixels are mixed it no longer works.
Example: https://codepen.io/devongovett/pen/ZEdNbgE
This works correctly in Chrome and Firefox.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/136420248>
Ahmad Saleem
Fixed in Safari Technology Preview 221 - it matches now Chrome Canary 139.0.7237.0 (Official Build) canary (arm64) and Firefox Nightly 141 (20250613211349).