Bug 85490 - Nested CSS flexbox renders flexbox items outside the containing block
Summary: Nested CSS flexbox renders flexbox items outside the containing block
Status: RESOLVED DUPLICATE of bug 83572
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Tony Chang
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-03 06:28 PDT by Victor Carbune
Modified: 2012-05-03 13:02 PDT (History)
3 users (show)

See Also:


Attachments
ComparisonScreenshot (21.48 KB, image/jpeg)
2012-05-03 06:28 PDT, Victor Carbune
no flags Details
html pages (1.01 KB, application/zip)
2012-05-03 06:31 PDT, Victor Carbune
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Carbune 2012-05-03 06:28:59 PDT
Created attachment 139998 [details]
ComparisonScreenshot

Context layout, main flexbox container:
* Flexbox Item 1 has flex: 1, and is itself a flexbox, with two divs as flexbox items.
* Flexbox Item 2 which is just a div with text.

Both flexbox containers have direction set to 'column' and alignment set to 'end'

Problem:
The two divs of are rendered outside the containing block.

This only happens with -webkit-flexbox, not with -webkit-box.
Comment 1 Victor Carbune 2012-05-03 06:31:01 PDT
Created attachment 139999 [details]
html pages
Comment 2 Tony Chang 2012-05-03 09:51:20 PDT
Sorry, I was on out the last few weeks.  I'll take a look at this today.
Comment 3 Tony Chang 2012-05-03 09:56:13 PDT
Err, I meant to write that on bug 83572.  This may be the same bug.
Comment 4 Caio Marcelo de Oliveira Filho 2012-05-03 12:37:18 PDT
Looking at the code, it seems strange to me that RenderFlexibleBox::computeAvailableFreeSpace(), when the flexbox have an override height (which I'm guessing was set by the outer flexbox in this case), we don't take in account the preferredMainAxisSize when returning.

However, even subtracting the preferredMainAxisSize, the content is still not correctly positioned, the bottom margins seems to be not counted here, so the Text Line 2 is too close to the edge.


Tony or Ojan, I'm also trying to turn this into a layout test. Is changing the text nodes into divs with predictable size and checking offset{Top,Bottom,Height,Width} be a good approach?
Comment 5 Tony Chang 2012-05-03 13:02:02 PDT
Yup, this is the same bug.

(In reply to comment #4)
> Looking at the code, it seems strange to me that RenderFlexibleBox::computeAvailableFreeSpace(), when the flexbox have an override height (which I'm guessing was set by the outer flexbox in this case), we don't take in account the preferredMainAxisSize when returning.
> 
> However, even subtracting the preferredMainAxisSize, the content is still not correctly positioned, the bottom margins seems to be not counted here, so the Text Line 2 is too close to the edge.

Right, we need to also subtract the padding, border and scrollbar size.  I.e., it's the difference between content height and height.

> 
> Tony or Ojan, I'm also trying to turn this into a layout test. Is changing the text nodes into divs with predictable size and checking offset{Top,Bottom,Height,Width} be a good approach?

I have a fix for this.  I'll include a similar case in my layout test.

*** This bug has been marked as a duplicate of bug 83572 ***