Re: [csswg-drafts] [css-flexbox-1] Intrinsic Main Size algo has errors (#7189)

Proposed changes:

```diff
diff --git a/css-flexbox-1/Overview.bs b/css-flexbox-1/Overview.bs
index 358740409..c5d628f65 100644
--- a/css-flexbox-1/Overview.bs
+++ b/css-flexbox-1/Overview.bs
@@ -2903,38 +2903,52 @@ Flex Container Intrinsic Main Sizes</h4>
    For each <a>flex item</a>,
    subtract its outer <a>flex base size</a> from its [[#intrinsic-item-contributions|max-content contribution]] size.
    If that result is positive,
-   divide by its <a>flex grow factor</a> floored at 1;
+   divide by its <a>flex grow factor</a>;
    if negative,
-   divide by its <a>scaled flex shrink factor</a>
-   having floored the <a>flex shrink factor</a> at 1.
-   This is the item's <var>max-content flex fraction</var>.
+   divide by its <a>scaled flex shrink factor</a>.
+   This is the item's <var>desired flex fraction</var>.
 
   <li>
    Place all <a>flex items</a> into lines of infinite length.
-
-  <li>
    Within each line,
-   find the largest <var>max-content flex fraction</var>
+   find the greatest (most positive)
+   <var>desired flex fraction</var>
    among all the <a>flex items</a>.
+   This is the line’s <var>chosen flex fraction</var>.
+
+  <li>
+   If the sum of the line’s <a>flex grow factors</a>
+   (<a>flex shrink factors</a>,
+   if the <var>chosen flex fraction</var> is negative)
+   is less than 1,
+   multiply the <var>chosen flex fraction</var> by that sum.
+
+  <li>
    Add each item’s <a>flex base size</a>
    to the product of its <a>flex grow factor</a>
-   (or <a>scaled flex shrink factor</a>, if the chosen <var>max-content flex fraction</var> was negative)
-   and the chosen <var>max-content flex fraction</var>,
+   (<a>scaled flex shrink factor</a>, if shrinking)
+   and the <var>chosen flex fraction</var>,
    then clamp that result by the <a>max main size</a>
    floored by the <a>min main size</a>.
 
   <li>
-   The <a>flex container</a>’s <a>max-content size</a> is the
-   largest sum of the afore-calculated sizes of all items within a single line.
+   The <a>flex container</a>’s <a>max-content size</a> is
+   the largest sum (among all the lines)
+   of the afore-calculated sizes of all items within a single line.
  </ol>
 
  The <strong><a>min-content</a> <a>main size</a></strong> of a <em><a>single-line</a></em> flex container
  is calculated identically to the <a>max-content</a> <a>main size</a>,
  except that the <a>flex items</a>’ [[#intrinsic-item-contributions|min-content contributions]] are used
  instead of their [[#intrinsic-item-contributions|max-content contributions]].
+
  However, for a <em><a>multi-line</a></em> container,
- it is simply the largest [[#intrinsic-item-contributions|min-content contribution]]
+ the [=min-content=] [=main size=] is simply the largest [[#intrinsic-item-contributions|min-content contribution]]
  of all the non-[=collapsed=] <a>flex items</a> in the <a>flex container</a>.
+ For this purpose,
+ each item's contribution
+ is capped by the item’s [=flex base size=] if the item is not growable,
+ and floored by the item’s [=flex base size=] if the item is not shrinkable.
 
  <details class=note>
   <summary>Implications of this algorithm when the sum of flex is less than 1</summary>
@@ -3003,17 +3017,13 @@ Flex Item Intrinsic Size Contributions</h4>
  is the larger of its <em>outer</em> <a>min-content size</a>
  and outer <a>preferred size</a> (its 'width'/'height' as appropriate)
  if that is not ''width/auto'',
- clamped by its <a>flex base size</a> as a maximum (if it is not growable)
- and/or as a minimum (if it is not shrinkable),
- and then further clamped by its <a lt="min main size">min</a>/<a>max main size</a>.
+ clamped by its <a lt="min main size">min</a>/<a>max main size</a>.
 
  The <strong>main-size <a>max-content contribution</a> of a <a>flex item</a></strong>
  is the larger of its <em>outer</em> <a>max-content size</a>
  and outer <a>preferred size</a> (its 'width'/'height' as appropriate)
  if that is not ''width/auto'',
- clamped by its <a>flex base size</a> as a maximum (if it is not growable)
- and/or as a minimum (if it is not shrinkable),
- and then further clamped by its <a lt="min main size">min</a>/<a>max main size</a>.
+ clamped by its <a lt="min main size">min</a>/<a>max main size</a>.
```

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


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

Received on Thursday, 31 March 2022 21:38:38 UTC