Bug 93411 - percentage margins + flex incorrectly overflows the flexbox
Summary: percentage margins + flex incorrectly overflows the flexbox
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: Ojan Vafai
URL: http://plexode.com/u/#2W%3C2V%3E2U%22...
Keywords:
Depends on:
Blocks: 62048
  Show dependency treegraph
 
Reported: 2012-08-07 16:56 PDT by Ojan Vafai
Modified: 2012-08-13 00:05 PDT (History)
6 users (show)

See Also:


Attachments
Patch (6.48 KB, patch)
2012-08-07 18:55 PDT, Ojan Vafai
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ojan Vafai 2012-08-07 16:56:22 PDT
See the test-case in the URL field.

The problem is that RenderFlexibleBox::computeMainAxisPreferredSizes incorrectly uses the height for computing percentage margin-top/bottom in column flexboxes. As per CSS2.1 percentage margins and padding should always be computed WRT the containing block's width.

When we call layoutIfNeeded in layoutAndPlaceChildren, the margin-top/bottom gets correctly set to the right value, so the flex items size and place correctly, but we compute the wrong preferred child size in RenderFlexibleBox::computeNextFlexLine if there is actually flex on any child.
Comment 1 Ojan Vafai 2012-08-07 18:55:38 PDT
Created attachment 157083 [details]
Patch
Comment 2 Tony Chang 2012-08-07 19:08:10 PDT
Comment on attachment 157083 [details]
Patch

Stupid bug.  Thanks for fixing.
Comment 3 Tony Chang 2012-08-07 19:44:59 PDT
We probably have the same bug with padding:
http://www.w3.org/TR/CSS21/box.html#padding-properties
Comment 4 WebKit Review Bot 2012-08-07 22:25:50 PDT
Comment on attachment 157083 [details]
Patch

Clearing flags on attachment: 157083

Committed r124987: <http://trac.webkit.org/changeset/124987>
Comment 5 WebKit Review Bot 2012-08-07 22:25:54 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Tony Chang 2012-08-13 00:05:57 PDT
(In reply to comment #3)
> We probably have the same bug with padding:
> http://www.w3.org/TR/CSS21/box.html#padding-properties

Nevermind.  We never interact with style()->padding* directly so this isn't a problem.