Bug 70839 - fix sizing of auto sized flexbox
Summary: fix sizing of auto sized flexbox
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tony Chang
URL:
Keywords:
Depends on:
Blocks: 62048
  Show dependency treegraph
 
Reported: 2011-10-25 12:34 PDT by Tony Chang
Modified: 2011-10-27 13:30 PDT (History)
4 users (show)

See Also:


Attachments
Patch (10.26 KB, patch)
2011-10-25 12:34 PDT, Tony Chang
no flags Details | Formatted Diff | Diff
Patch (18.28 KB, patch)
2011-10-26 12:10 PDT, Tony Chang
no flags Details | Formatted Diff | Diff
Patch (17.85 KB, patch)
2011-10-26 13:13 PDT, Tony Chang
no flags Details | Formatted Diff | Diff
Patch (17.78 KB, patch)
2011-10-26 13:13 PDT, Tony Chang
no flags Details | Formatted Diff | Diff
Patch (14.16 KB, patch)
2011-10-27 12:15 PDT, Tony Chang
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Chang 2011-10-25 12:34:18 PDT
fix sizing of auto sized flexbox
Comment 1 Tony Chang 2011-10-25 12:34:40 PDT
Created attachment 112375 [details]
Patch
Comment 2 Tony Chang 2011-10-25 12:35:24 PDT
This patch needs more tests.  I'm uploading it so Ojan can try it out a bit.
Comment 3 Tony Chang 2011-10-26 12:10:11 PDT
Created attachment 112574 [details]
Patch
Comment 4 WebKit Review Bot 2011-10-26 12:11:59 PDT
Attachment 112574 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/css2..." exit_code: 1

Source/WebCore/rendering/RenderImage.cpp:481:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Source/WebCore/rendering/RenderImage.cpp:500:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Source/WebCore/rendering/svg/RenderSVGRoot.cpp:273:  Should have only a single space after a punctuation in a comment.  [whitespace/comments] [5]
Total errors found: 3 in 49 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Ojan Vafai 2011-10-26 12:26:48 PDT
Comment on attachment 112574 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=112574&action=review

Code changes look good to me. Just a couple nits.

> Source/WebCore/rendering/RenderFlexibleBox.cpp:709
>          if (hasPackingSpace(availableFreeSpace, totalPositiveFlexibility) && style()->flexPack() == PackJustify && childSizes.size() > 1)
>              startEdge += availableFreeSpace / (childSizes.size() - 1);
>      }
> +    if (isColumnFlow() && flowAwareLogicalWidthLength().isAuto())
> +        setFlowAwareLogicalWidth(startEdge);

Maybe add a flex-pack test case to ensure that the last addition of "availableFreeSpace / (childSizes.size() - 1)" gets the correct result?

> LayoutTests/css3/flexbox/columns-auto-size.html:53
> +<body onload="checkFlexBoxen(); checkFlexBoxen('flexbox-vertical-rl')">

I'm not opposed to this change, but it doesn't seem necessary. Just make vertical-rl a separate classname and make the class of these boxes be "flexbox vertical-rl". It's what we do in the other tests.
Comment 6 Tony Chang 2011-10-26 13:13:11 PDT
Created attachment 112581 [details]
Patch
Comment 7 Tony Chang 2011-10-26 13:13:52 PDT
Created attachment 112582 [details]
Patch
Comment 8 Tony Chang 2011-10-26 13:14:49 PDT
(In reply to comment #5)
> (From update of attachment 112574 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=112574&action=review
> 
> > Source/WebCore/rendering/RenderFlexibleBox.cpp:709
> >          if (hasPackingSpace(availableFreeSpace, totalPositiveFlexibility) && style()->flexPack() == PackJustify && childSizes.size() > 1)
> >              startEdge += availableFreeSpace / (childSizes.size() - 1);
> >      }
> > +    if (isColumnFlow() && flowAwareLogicalWidthLength().isAuto())
> > +        setFlowAwareLogicalWidth(startEdge);
> 
> Maybe add a flex-pack test case to ensure that the last addition of "availableFreeSpace / (childSizes.size() - 1)" gets the correct result?

Done, although it's not that interesting because with an auto height, the available free space is always 0.

> > LayoutTests/css3/flexbox/columns-auto-size.html:53
> > +<body onload="checkFlexBoxen(); checkFlexBoxen('flexbox-vertical-rl')">
> 
> I'm not opposed to this change, but it doesn't seem necessary. Just make vertical-rl a separate classname and make the class of these boxes be "flexbox vertical-rl". It's what we do in the other tests.

Done (had to add a horizontal class, but that's not a big deal).
Comment 9 Dave Hyatt 2011-10-26 13:34:13 PDT
Comment on attachment 112582 [details]
Patch

Minusing as per discussion in IRC. I think you need to back up and implement preferred widths.
Comment 10 Dave Hyatt 2011-10-26 13:38:41 PDT
Comment on attachment 112582 [details]
Patch

r=me
Comment 11 Tony Chang 2011-10-27 12:15:14 PDT
Created attachment 112727 [details]
Patch
Comment 12 Dave Hyatt 2011-10-27 12:26:31 PDT
Comment on attachment 112727 [details]
Patch

r=me
Comment 13 Tony Chang 2011-10-27 13:30:16 PDT
Committed r98628: <http://trac.webkit.org/changeset/98628>