Open
Bug 1264520
Opened 9 years ago
Updated 1 year ago
Support mixed number, unit value, and percent for calc() parser including type checking
Categories
(Core :: CSS Parsing and Computation, defect, P3)
Core
CSS Parsing and Computation
Tracking
()
NEW
People
(Reporter: boris, Unassigned)
References
(Blocks 2 open bugs, )
Details
(Keywords: dev-doc-needed)
According to Bug 594933 comment 28 and 29, the unit checking in the parsing code needs additional changes. For example, our code can parse calc(1 + 2) and calc(1px + 2px),
but doesn't accept calc(1 + 2px),
which ought to be accepted for line-height, stroke-dashoffset, and stroke-width. There is various code in the functions inside of ParseCalc that needs updating, and some comments also need updating. There's currently no spec for it, but it's better to handle this case.
Also, my understanding from bug 594933 is that other browser engines don't currently support this (I think that's silly, but it's also the reason I said fixing bug 594933 without this was OK). If that changes, somebody should update this bug to say so!
Reporter | ||
Updated•9 years ago
|
Comment 3•8 years ago
|
||
(In reply to Boris Chiou [:boris] from comment #0)
> For example, our code can parse calc(1 + 2)
(To clarify something that confused me initially -- so, you're right that we do support that expression *for line-height*, but we don't support calc(number+number) or calc(integer+integer) in general, e.g. in the number-valued "opacity" property or the integer-valued "z-index" property. Bug 1296209 partly covers that. calc(1+2) only works for "line-height" via a custom "SetLineHeightCalcOps" calc-handling class that lives in nsRuleNode.cpp right now.)
Updated•8 years ago
|
Blocks: calc-issues
Updated•8 years ago
|
Keywords: dev-doc-needed
Comment 4•7 years ago
|
||
What's possible for calc() and what not is outlined in https://drafts.csswg.org/css-values-3/#calc-notation.
Sebastian
I believe that's extended in https://drafts.csswg.org/css-values-4/#calc-notation
Comment 6•2 years ago
|
||
Does this bug cover type checking as defined in CSS Values 4? I.e. will it be used to cover unit algebra with multiplication and division like calc(3rem / 2rem)
?
Sebastian
Flags: needinfo?(boris.chiou)
Reporter | ||
Comment 7•2 years ago
|
||
This bug was filed for the legacy implementation of calc(). Now we are using Rust to parse calc(), so I think we definitely can extend this bug to cover the case you mentioned (i.e. including all the type checking for calc()). Feel free to update the title if needed.
Flags: needinfo?(boris.chiou)
Updated•2 years ago
|
Severity: normal → S3
Updated•1 year ago
|
Summary: Support mixed number, unit value, and percent for calc() parser → Support mixed number, unit value, and percent for calc() parser including type checking
You need to log in
before you can comment on or make changes to this bug.
Description
•