Support calc() on stroke-width, stroke-dasharray and stroke-dashoffset
Categories
(Core :: CSS Parsing and Computation, defect, P3)
Tracking
()
People
(Reporter: boris, Unassigned)
References
(Blocks 2 open bugs, )
Details
(Keywords: dev-doc-needed)
| Reporter | ||
Updated•10 years ago
|
Updated•10 years ago
|
| Reporter | ||
Updated•10 years ago
|
| Reporter | ||
Updated•10 years ago
|
| Reporter | ||
Comment 1•10 years ago
|
||
| Reporter | ||
Updated•10 years ago
|
Comment 2•10 years ago
|
||
| important | ||
| Reporter | ||
Updated•10 years ago
|
| Reporter | ||
Updated•9 years ago
|
| Reporter | ||
Comment 3•9 years ago
|
||
Updated•9 years ago
|
Updated•8 years ago
|
| Reporter | ||
Updated•7 years ago
|
Comment 5•6 years ago
|
||
I see this was closed as a dupe of bug #1218257 (marked fixed in v67) yet I tested on v72.0.2 stable and setting a calc value for stroke-width doesn't appear to change it, instead falling back to the default 1 stroke-width.
Eg: using embedded CSS within an SVG and applying stroke-width: calc(2 * 4); to a path doesn't affect its stroke-width, yet does in Chromium which additionally supports utilizing CSS variables for stroke-width with calc (as it seems to for everything else I've encountered).
Comment 6•6 years ago
|
||
It works if you properly specify the unit, like: calc(2px * 4).
Also, chrome doesn't seem to behave as I'd expect either: stroke-width: calc(2 * 2); does parse, but it gives me a computed value of 2px instead of 4px. It gives me 0px in Safari. stroke-width: calc(2px * 2) works as I'd expect in all browsers.
It's unclear to me if that case is working as per spec or not, seems to me like numbers are ambiguous in calc() expressions like that.
I'll file bugs in other browsers / the spec to hopefully get them to behave like Firefox does.
Comment 7•6 years ago
|
||
I filed https://github.com/w3c/csswg-drafts/issues/4874 and bugs for other browsers as linked above.
Comment 8•6 years ago
|
||
Using CSS variables seems to work as expected here too, if there are units specified.
Description
•