-
Notifications
You must be signed in to change notification settings - Fork 756
Description
https://drafts.csswg.org/css-flexbox-1/#intrinsic-main-sizes says
For each flex item, subtract its outer flex base size from its max-content contribution size.
- This result has pixel units.
If that result is positive, divide by its flex grow factor floored at 1
- This result has pixel units.
if negative, divide by its scaled flex shrink factor having floored the flex shrink factor at 1.
-
This result has no units because scaled flex shrink factor has pixel units. scaled flex shrink factor is equal to flex shrink factor * inner flex base size (https://drafts.csswg.org/css-flexbox-1/#scaled-flex-shrink-factor).
Put another way and expanding some terms:
(
flex base size-max-content contribution size) / (inner flex base size* max(1,flex shrink factor))Numerator and denominator both have pixel units so the result is unitless.
This is the item’s max-content flex fraction
So items in the same flexbox can have max-content flex fractions of different units depending on if the result of the first step is positive or negative. That doesn't seem right. Maybe
if negative, divide by its
scaled flex shrink factorhaving floored theflex shrink factorat 1.
should be the following?
if negative, divide by its
flex shrink factorfloored at 1.
/cc @fantasai and @dholbert who appear to have developed this algorithm originally