Bug 86913 - auto margins on flexbox should allocate space in the cross direction
Summary: auto margins on flexbox should allocate space in the cross direction
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (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: 2012-05-18 15:46 PDT by Tony Chang
Modified: 2012-05-23 17:19 PDT (History)
4 users (show)

See Also:


Attachments
Patch (28.49 KB, patch)
2012-05-23 14:06 PDT, Tony Chang
no flags Details | Formatted Diff | Diff
Patch (30.18 KB, patch)
2012-05-23 14:50 PDT, Tony Chang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Chang 2012-05-18 15:46:43 PDT
See the section here:
http://dev.w3.org/csswg/css3-flexbox/#auto-margins

We're currently treating auto margins as 0.

See also 83086.
Comment 1 Tony Chang 2012-05-23 14:06:52 PDT
Created attachment 143647 [details]
Patch
Comment 2 Ojan Vafai 2012-05-23 14:20:28 PDT
Comment on attachment 143647 [details]
Patch

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

> Source/WebCore/rendering/RenderFlexibleBox.cpp:720
> +        child->setMarginTop(availableAlignmentSpace / 2);
> +        child->setMarginBottom(availableAlignmentSpace / 2);
> +        return true;
> +    }
> +    if (start.isAuto()) {
> +        adjustAlignmentForChild(child, availableAlignmentSpace);
> +        child->setMarginTop(availableAlignmentSpace);
> +        return true;
> +    }
> +    if (end.isAuto()) {
> +        child->setMarginBottom(availableAlignmentSpace);

If we're in a vertical flow, don't we want to be setting marginLeft/marginRight?
Comment 3 Tony Chang 2012-05-23 14:50:58 PDT
Created attachment 143658 [details]
Patch
Comment 4 Tony Chang 2012-05-23 14:51:25 PDT
(In reply to comment #2)
> (From update of attachment 143647 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=143647&action=review
> 
> > Source/WebCore/rendering/RenderFlexibleBox.cpp:720
> > +        child->setMarginTop(availableAlignmentSpace / 2);
> > +        child->setMarginBottom(availableAlignmentSpace / 2);
> > +        return true;
> > +    }
> > +    if (start.isAuto()) {
> > +        adjustAlignmentForChild(child, availableAlignmentSpace);
> > +        child->setMarginTop(availableAlignmentSpace);
> > +        return true;
> > +    }
> > +    if (end.isAuto()) {
> > +        child->setMarginBottom(availableAlignmentSpace);
> 
> If we're in a vertical flow, don't we want to be setting marginLeft/marginRight?

Yes, you're right.  Fixed and a test case added in auto-margins.html.
Comment 5 WebKit Review Bot 2012-05-23 17:19:01 PDT
Comment on attachment 143658 [details]
Patch

Clearing flags on attachment: 143658

Committed r118279: <http://trac.webkit.org/changeset/118279>
Comment 6 WebKit Review Bot 2012-05-23 17:19:05 PDT
All reviewed patches have been landed.  Closing bug.