Re: [csswg-drafts] [css-flexbox-1] Should Flex Container Intrinsic Main Size algorithm really use _scaled_ flex shrink factor? (#6909)

Here's the context from https://drafts.csswg.org/css-flexbox/#intrinsic-main-sizes

1. For each flex item, subtract its outer flex base size from its max-content contribution size. If that result is positive, divide by its flex grow factor floored at 1; if negative, divide by its scaled flex shrink factor having floored the flex shrink factor at 1. This is the item’s max-content flex fraction.
2. Place all flex items into lines of infinite length.
3. Within each line, find the largest max-content flex fraction among all the flex items. Add each item’s flex base size to the product of its flex grow factor (or scaled flex shrink factor, if the chosen max-content flex fraction was negative) and the chosen max-content flex fraction, then clamp that result by the max main size floored by the min main size.

As described in comment 0, step 1 produces max-content flex fractions with different units for different flex items. The units hinge on the result of the first subtraction being positive or negative. Step 3 imposes an ordering on the max-content flex fractions of varied units, which is the undefined part.

I interpret step 3 as doing this:
* If _any_ item needs to grow to meet its max-content contribution size (i.e. the result from step 1 is positive), we're in "grow mode" where the goal is to increase the max-content size of the container past the sum of the flex base sizes. So, add enough to each flex base size so that after the flex algorithm runs, each item is at least as large as its max-content contribution.
* Else, if _no_ item needs to grow (this is given because we're not in the above step) and >0 items can shrink, we're in "shrink mode." Subtract as much as you can from each flex base size such after the flex algorithm runs, each item is at least as large as its max-content contribution, with at least one item's flex base size being exactly equal to its max-content contribution size.
* The max-content size is the sum of the resultant flex base sizes.

That description ignores forced line breaks and items with min/max main sizes.

In step 3, the current spec amalgamates selecting which mode to be in with calculating how much to add to or subtract from the flex base sizes.

-- 
GitHub Notification of comment by davidsgrogan
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6909#issuecomment-1015916244 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 18 January 2022 23:11:29 UTC