Re: [css3-flexbox] min/max need to be swapped in step 6 of "resolve the flexible lengths"

Resurrecting this thread from a month ago -- I don't believe anyone has
addressed this on the list. (and it looks like the ED hasn't changed to
address this, either)

Alex or Tab: as noted below, I'm pretty sure the logic is backwards here
-- could you take a look, and fix the spec if you agree?

Thanks,
~Daniel

On 03/09/2012 12:26 PM, Daniel Holbert wrote:
> Hi www-style,
> 
> I think the current Flexbox Layout Algorithm has some words reversed
> right now, in such a way that it'd never terminate if it were to be
> implemented as-written.
> 
> It currently says:
> {{
> 4. Distribute free space proportional to flex
>   [...]
> 5. Fix min/max violations:
>     1. Adjust each flexible item for min/max.
>     2. If the size has changed, it is a violation.
>     3. The violation may be positive (min violation) or
>        negative (max violation). Accumulate the difference.
> 
> 6. If the sum of all violations is:
>   Zero:     Exit the algorithm.
>   Positive: Freeze items with max violations, and return to step 2.
>   Negative: Freeze items with min violations, and return to step 2.
> }}
> http://dev.w3.org/csswg/css3-flexbox/#resolve-the-flexible-lengths
> 
> 
> TL;DR; I think min/max are reversed in step 6 there.
> 
> 
> MORE DETAILS / AN EXAMPLE:
> ==========================
> Suppose we're in a situation with two flexbox items, both flex:1 0 0px,
> and we have plenty of extra space to distribute.  One of our items is
> constrained by a max-width. (and that's the only min/max limit in play)
> 
> Suppose there's enough free space that we violate the item's max-width
> in Step 4.
> 
> So -- when we hit Step 5, we'll reduce that item's size to match its
> max-width.  This is a "negative (max violation)" according to 5.3 above.
> 
> That was the only violation -- so in step 6, the sum of all violations
> is negative.
> 
> Given that, step 6 says we should "Freeze items with min violations..."
> (uh oh, we didn't have any of those!) "...and return to step 2".
> 
> So we don't freeze anything, and we'll repeat the exact same steps and
> we'll hit the exact same violation over & over again, looping forever.
> 
> If we swap "min" and "max" in step 6, then I think it makes sense &
> terminates.
> 
> ~Daniel
> 

Received on Tuesday, 17 April 2012 22:38:26 UTC