On 3/7/12 6:40 AM, Sravan wrote:
Ok, The first thing i would appreciate to see is what is the reference/logic to say that LEGEND element should behave as normally as if no styling is provided either to it or to its children.
This is not special to <legend>. You just have a shrink-wrapping block formatting context root. If you actually think about how that would behave, it will behave identically if it has a single child whether that child is an inline, an otherwise-unstyled block, or a float. At least as far as I can tell.
Again, with sufficient styling on the child you can tell the three cases apart. It's just the special case of a child with absolutely no styles on it that looks identical, by happenstance.
After that, i just want to know which part of the mozilla code makes it to behave the same irrespective of LEGEND being float or its children being float?
The <legend> is not floated in your testcase, but the behavior is in fact the same for auto-width floats, simply because the shrink-wrap.
The code for <legend> is in http://mxr.mozilla.org/mozilla-central/source/layout/forms/nsLegendFrame.h and http://mxr.mozilla.org/mozilla-central/source/layout/forms/nsLegendFrame.cpp but once again it's just a shrink-wrapping BFC root... You can get the same effect with auto-width floats, table cells, auto-width absolutely positioned blocks, or any BFC root explicitly styled to shrink-wrap. I'll bet money that WebKit handles most of those cases identically to Gecko; it may simply have different treatment for <legend> for some reason.
-Boris _______________________________________________ dev-tech-layout mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-layout

