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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>105512</bug_id>
          
          <creation_ts>2012-12-20 01:47:34 -0800</creation_ts>
          <short_desc>Avoid a second layout of flex items in computeMainAxisPreferredSizes</short_desc>
          <delta_ts>2017-07-18 08:29:30 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>62048</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Carlos Garcia Campos">cgarcia</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>eric</cc>
    
    <cc>ojan.autocc</cc>
    
    <cc>tony</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>795282</commentid>
    <comment_count>0</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2012-12-20 01:47:34 -0800</bug_when>
    <thetext>In case of orthogonal flow when the flex basis or min main axis are auto for child, we are laying out the child in computeMainAxisPreferredSizes. If called a second time, we don&apos;t need to re-layout the child unless its main axis size is a percentage.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>795286</commentid>
    <comment_count>1</comment_count>
      <attachid>180302</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2012-12-20 01:49:40 -0800</bug_when>
    <thetext>Created attachment 180302
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>795532</commentid>
    <comment_count>2</comment_count>
    <who name="Tony Chang">tony</who>
    <bug_when>2012-12-20 10:09:36 -0800</bug_when>
    <thetext>It seems like if the flex size is different from the preferred size, during a relayout, you&apos;ll use the previous flex size instead of recomputing the preferred size.  I&apos;m not sure we have a test case that does this, but we should try to add one.

Another idea would be to cache the child&apos;s preferred size and if we don&apos;t need to relayout the child, we could use the cached preferred size.  Not sure how much of a win that really is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>795632</commentid>
    <comment_count>3</comment_count>
    <who name="Tony Chang">tony</who>
    <bug_when>2012-12-20 11:58:47 -0800</bug_when>
    <thetext>Here&apos;s an example:
http://plexode.com/eval3/#ht=%3Cdiv%20id%3D%22container%22%20style%3D%22height%3A%20200px%22%3E%0A%3Cdiv%20style%3D%22display%3A-webkit-flex%3B%20-webkit-flex-flow%3A%20column%3B%20height%3A%20100%25%22%3E%0A%20%20%3Cdiv%20id%3D%22a%22%20style%3D%22-webkit-flex%3A%201%20auto%3B%20background-color%3A%20pink%3B%22%3Ea%3C%2Fdiv%3E%0A%20%20%3Cdiv%20id%3Db%20style%3D%22-webkit-flex%3A%201%2050px%3B%20background-color%3A%20lime%3B%22%3Eb%3C%2Fdiv%3E%0A%3C%2Fdiv%3E%0A%3C%2Fdiv%3E&amp;ohj=0&amp;jt=container.style.height%20%3D%20%22100px%22%0AgetComputedStyle(a).height%20%2B%20%22%2C%22%20%2B%20getComputedStyle(b).height&amp;ojh=0&amp;ojj=0

Press the &quot;eval JS now&quot; button.  It reduces the height of the container, but we don&apos;t relayout the flex children, so they stay the same size.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>796128</commentid>
    <comment_count>4</comment_count>
      <attachid>180302</attachid>
    <who name="Build Bot">buildbot</who>
    <bug_when>2012-12-20 21:29:42 -0800</bug_when>
    <thetext>Comment on attachment 180302
Patch

Attachment 180302 did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/15460195

New failing tests:
css3/flexbox/flexitem.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>796270</commentid>
    <comment_count>5</comment_count>
      <attachid>180302</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2012-12-21 06:14:52 -0800</bug_when>
    <thetext>Comment on attachment 180302
Patch

Clearing flags since the patch is not correct</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>180302</attachid>
            <date>2012-12-20 01:49:40 -0800</date>
            <delta_ts>2012-12-21 06:14:52 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>wcore-flexbox-relayout.diff</filename>
            <type>text/plain</type>
            <size>1988</size>
            <attacher name="Carlos Garcia Campos">cgarcia</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZwppbmRleCA2YTUxOTZmLi44YzFiNWRiIDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViQ29y
ZS9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTkg
QEAKKzIwMTItMTItMjAgIENhcmxvcyBHYXJjaWEgQ2FtcG9zICA8Y2dhcmNpYUBpZ2FsaWEuY29t
PgorCisgICAgICAgIEF2b2lkIGEgc2Vjb25kIGxheW91dCBvZiBmbGV4IGl0ZW1zIGluIGNvbXB1
dGVNYWluQXhpc1ByZWZlcnJlZFNpemVzCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3Jn
L3Nob3dfYnVnLmNnaT9pZD0xMDU1MTIKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9P
UFMhKS4KKworICAgICAgICBJbiBjYXNlIG9mIG9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