W3C home > Mailing lists > Public > www-style@w3.org > April 2014

Re: [css-flexbox] Tweaking the old "resolving flexible lengths" algorithm to produce same behavior as new algorithm

From: Daniel Holbert <dholbert@mozilla.com>
Date: Thu, 24 Apr 2014 14:12:15 -0700
Message-ID: <53597E2F.6070501@mozilla.com>
To: www-style list <www-style@w3.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
I'm posting to update/improve what I *think* is a tweak to the old
"resolve flexible lengths" algorithm that makes it gracefully handle
flex values that sum to less than 1, and produce the same results as
what the new algorithm tries to achieve, I think. (but without needing
to rip anything out and start from scratch).

My suggested tweak now is now entirely contained in Step 5 of the old
algorithm. Here it is, in context:
   # Step 5:
   # If the sign of the free space is positive and the
   # algorithm is using the flex grow factor, or if the
   # sign of the free space is negative and the
   # algorithm is using the flex shrink factor:
   #
 [BEGIN INSERTION:]
   #  a) If the "original free space" has not yet been
   #     initialized, then set it to the free space.
   #
   #  b) Compute the sum of the unfrozen flex items'
   #     flex factors. If this sum is less than 1,
   #     compute the product of this sum and the
   #     "original free space". If this product's
   #     absolute value is less than the free space's
   #     absolute value, then set the free space to
   #     this product.
   #
 [END INSERTION] (adding "letter c" label to the following spec-text)
   #  c) Distribute the free space to each flexible item's
   #     main size in proportion to the item's flex factor:
   #     [etc etc]

For reference, the old spec text being modified here is at this URL:
http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/#resolve-flexible-lengths


Thoughts/feedback/issues welcomed.

(I'm gaining confidence that it'd be worth making a targeted tweak like
this to the old algorithm, instead of using the all-new algorithm, per
the reasoning laid out at the end of my first message in this thread.)

~Daniel
Received on Thursday, 24 April 2014 21:12:42 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:21 UTC