Bug 594933 implemented calc() on line-height and Bug 1218257 will implement calc() on stroke-dashoffset. We still need calc() on stroke-width and stroke-dasharray.
Summary: Support calc() to stroke-width and stroke-dasharray → Support calc() on stroke-width and stroke-dasharray
We'd like to support calc() on properties that accept <number> values, so in this bug, I think we should implement these items: 1. stroke-dasharray: The property value of stroke-dasharray is "none | <dasharray>", and "<dasharray>" is "[ <length> | <percentage> | <number> ]#*" . In this bug, I think we could add calc() into <dasharray>, so it'd be like this: "[ <length> | <percentage> | <number> | <calc()> ]#*". 2. stroke-width: The spec  says, the value of stroke-width is "<percentage> | <length>", and I don't see the <number> in it, so I'm not sure if implementing calc() in stroke-width is acceptable. However, CSS-value-3  says "It can be used wherever <length>, <frequency>, <angle>, <time>, <number>, or <integer> values are allowed.", so I think we still could support calc() on stroke-width. Let the value of stroke-width be "<percentage> | <length> | <calc()>".  https://svgwg.org/svg2-draft/painting.html#DataTypeDasharray  https://svgwg.org/svg2-draft/painting.html#StrokeWidth  https://drafts.csswg.org/css-values-3/#calc-notation
Assignee: nobody → boris.chiou
Status: NEW → ASSIGNED
Part of the reason these are interesting is that SVG properties allow raw numbers (meaning pixels) in place of lengths. See the CSS_PROPERTY_NUMBERS_ARE_PIXELS flag. The other property that does this is stroke-dashoffset (bug 1218257). So the calc() code for these properties needs to treat <number> values as pixel lengths, but only in the appropriate places. For all three properties, there would be a stored calc() in the style structs. So it's possible this transformation could happen relatively late -- which is different from the way <number> works normally for these properties (converted relatively early). I haven't thought about the problem enough to think about what I think the best solution is, but happy to discuss further later. (I'm in a meeting now, though, so just writing a brief comment.)
Summary: Support calc() on stroke-width and stroke-dasharray → Support calc() on stroke-width, stroke-dasharray and stroke-dashoffset
Assignee: boris.chiou → nobody
Status: ASSIGNED → NEW
I'm working on other bugs in this quarter, so remove the assignee.
Status: NEW → RESOLVED
Closed: 23 days ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1218257
You need to log in before you can comment on or make changes to this bug.