<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>16856</bug_id>
          
          <creation_ts>2012-04-25 15:39:43 +0000</creation_ts>
          <short_desc>consider using division for negative flexibility</short_desc>
          <delta_ts>2012-06-07 20:11:02 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>Flexbox</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://lists.w3.org/Archives/Public/www-style/2012Apr/0692.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alex Mogilevsky">alexmog</reporter>
          <assigned_to name="Tab Atkins Jr.">jackalmage</assigned_to>
          <cc>alexmog</cc>
    
    <cc>cmarcelo</cc>
    
    <cc>dbaron</cc>
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>67023</commentid>
    <comment_count>0</comment_count>
    <who name="Alex Mogilevsky">alexmog</who>
    <bug_when>2012-04-25 15:39:43 +0000</bug_when>
    <thetext>(see email thread)

Currently, flexibility is always addition and subtraction, not multiplication or division. It makes sense when stretching - when items already have the space they wanted, they get equal share of additional space (given same flexibility).

But when shrinking, subtraction isn&apos;t really a good way of fair distribution. It works OK with minor adjustments, but if space shortage is significant and some items are much bigger than others, small items quickly shrink to zero (or their min size), while big fat items may not even notice. The problem can be mitigated by giving bigger items bigger negative flex, but it is only possible if the author knows what will be bigger...

Shrinking should be done by *dividing* the flexible lengths proportional to flexibility. Something like this:

	shrink-factor = sum(preferred-size / negative-flex) / available-space
	used-main-size = main-size / (shrink-factor * negative-flex)

this way, when shrinking, flex items remain proportional to their preferred size.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67467</commentid>
    <comment_count>1</comment_count>
    <who name="Alex Mogilevsky">alexmog</who>
    <bug_when>2012-05-08 01:52:33 +0000</bug_when>
    <thetext>correct formula for the desired result is this:

space-shortage = sum(flex-basis) - available-space
shrink-factor = space-shortage / sum(flex-basis * negative-flex))
main-size = flex-basis * (1 - shrink-factor * negative-flex))

(previous proposed formula immediately scales all items by their negative flex and gets divizion by zero when negative-flex is zero)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68850</commentid>
    <comment_count>2</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2012-06-07 20:11:02 +0000</bug_when>
    <thetext>Done.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>