-
Notifications
You must be signed in to change notification settings - Fork 756
Description
In #1731 we decided to serialize percentages before dimensioned values.
Existing browsers have varied behavior when there are negatives in a computed value: Safari uses -20px - 10%. Blink previously used -20px + -10% and now uses -10% + -20px. Legacy Firefox code uses -20px - 10% and more recent (Servo) code uses -10% - 20px. Edge often reduces a <length-percentage> to a <length>.
A subtraction often occurs in the context of a computed value arising from a <position>, e.g. right 200px bottom 200px.
Should calc(100% - 200px) serialize as-is, or should this be calc(100% + -200px)?
Various WPTs expect the former, but a literal reading of the spec requires the latter:
Serialize all the terms, then join them into a single string, with " + " between each term.
If the former is preferred, we might want to add a sentence:
Replace any resulting " + -" with " - ".
This would leave a specified value like calc(100% + max(-10%, -200px)) unchanged.
The spec could also use an example or text showing how to simplify/serialize a specified value like calc(100% - max(10%, 200px))