Bug 87546

Summary: Implied minimum size of flex items is min-content
Product: WebKit Reporter: Tony Chang <tony>
Component: Layout and RenderingAssignee: Ojan Vafai <ojan>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, ojan, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 88437    
Bug Blocks: 62048    
Attachments:
Description Flags
Patch tony: review+

Description Tony Chang 2012-05-25 16:11:21 PDT
In new flexbox, the min-{width,height} in the flex direction should default to min-content.  This avoids overflowing flex items if we can shrink another item.  It also means we will overflow the flexbox rather than flex items.

http://dev.w3.org/csswg/css3-flexbox/#min-size-auto
Comment 1 Ojan Vafai 2012-07-12 13:25:06 PDT
Created attachment 152045 [details]
Patch
Comment 2 Tony Chang 2012-07-12 13:52:18 PDT
Comment on attachment 152045 [details]
Patch

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

> Source/WebCore/rendering/RenderFlexibleBox.cpp:754
> +        Length min = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight();

Nit: childMin or maybe even childMainAxisMin

> Source/WebCore/rendering/RenderFlexibleBox.cpp:805
> +        if (childSize < minContent)
> +            return minContent;

Nit: You could either return std::max(childSize, minContent) or assign that value to childSize.

> LayoutTests/css3/flexbox/flex-item-min-size.html:41
> +    <div>Tests that flex items have default min-size to min-content in the main axis direction.</div>

It would be nice to test this for other writing modes.
Comment 3 Ojan Vafai 2012-07-12 14:38:40 PDT
Committed r122508: <http://trac.webkit.org/changeset/122508>