Support calc() on stroke-width, stroke-dasharray and stroke-dashoffset

RESOLVED DUPLICATE of bug 1218257

Status

()

defect
P3
normal
RESOLVED DUPLICATE of bug 1218257
3 years ago
23 days ago

People

(Reporter: boris, Unassigned)

Tracking

(Blocks 2 bugs, {dev-doc-needed})

Firefox Tracking Flags

(Not tracked)

Details

()

Reporter

Description

3 years ago
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.
Reporter

Updated

3 years ago
Summary: Support calc() to stroke-width and stroke-dasharray → Support calc() on stroke-width and stroke-dasharray
Reporter

Updated

3 years ago
Blocks: css-values-3
Reporter

Comment 1

3 years ago
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> ]#*" [1].
   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 [2] 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 [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()>".

[1] https://svgwg.org/svg2-draft/painting.html#DataTypeDasharray
[2] https://svgwg.org/svg2-draft/painting.html#StrokeWidth
[3] https://drafts.csswg.org/css-values-3/#calc-notation
Reporter

Updated

3 years ago
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.)
Reporter

Updated

3 years ago
Summary: Support calc() on stroke-width and stroke-dasharray → Support calc() on stroke-width, stroke-dasharray and stroke-dashoffset
Reporter

Updated

3 years ago
Assignee: boris.chiou → nobody
Status: ASSIGNED → NEW
Reporter

Comment 3

3 years ago
I'm working on other bugs in this quarter, so remove the assignee.
Priority: -- → P3
Blocks: 1376206
Reporter

Updated

23 days ago
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.