When set margin property to a child node of flex item, it does not effect. See the test case here https://test.csswg.org/shepherd/repository/tip/contributors/ttwf_bj/winter/submitted/flex-flexitem-childmargin.html
Created attachment 169804 [details] reduced testcase with webkit prefixes
Presumably this is margin-collapsing doing the wrong thing. I'm not actually sure this is technically wrong though. margin-collapsing is just kind of crazy.
Created attachment 169805 [details] margin-collapsing without flexbox
This looks to me as working as intended. Please reopen if I'm wrong. margin-collapsing is just very confusing and complicated. Tab, didn't you have some idea for limiting margin-collapsing that might simplify some of the more confusing situations (like this one)?
Created attachment 169818 [details] margin-collapsing without flexbox ('overflow: hidden') The spec says a flex container establishes a block formatting context and so I attached a version of the test case with 'overflow: hidden;' set on the corresponding element. An earlier version (two months ago?) of spec says each flex item establishes a BFC so the first example in my test case is set with such, which I consider the expected behavior. But even without the reason above, setting the 'margin-top' of the element in question (the first child of a flex item) to, say, 20000em would not push the element out of the window. That is, I don't think the top margin of the element is collapsed with anything else. It is just always zero. For what it's worth, both Opera Next and Firefox nightly work as expected but I don't have IE10 at hands. So yes, I think this should be reopened. Unfortunately I don't have editbug.
(In reply to comment #5) > An earlier version (two months ago?) of spec says each flex item establishes a BFC so the first example in my test case is set with such, which I consider the expected behavior. the second, I mean.
I think you're right. Reopening.
I think we just need to update RenderBlock::MarginInfo::MarginInfo to know about flexboxes.
(In reply to comment #5) > Created an attachment (id=169818) [details] > margin-collapsing without flexbox ('overflow: hidden') > > The spec says a flex container establishes a block formatting context and so I attached a version of the test case with 'overflow: hidden;' set on the corresponding element. An earlier version (two months ago?) of spec says each flex item establishes a BFC so the first example in my test case is set with such, which I consider the expected behavior. Hm, I didn't intend to lose that text about the flex items being BFCs. I'll bring it up on the list, I suspect it was an editting mistake.
But yeah, Ojan, intention is definitely that children of a flex item do *not* collapse their margins with the flex item. Flex item margins are intended to be fully independent.
Created attachment 170016 [details] Patch
+julien, who may know other situations where a RenderObject doesn't have a parent.
(In reply to comment #12) > +julien, who may know other situations where a RenderObject doesn't have a parent. Your check is right as the tree is stable and properly attached during layout.
Comment on attachment 170016 [details] Patch Clearing flags on attachment: 170016 Committed r132164: <http://trac.webkit.org/changeset/132164>
All reviewed patches have been landed. Closing bug.