Re: [css3-flexbox] computing "float" and "clear" on children of a flexbox

On Wed, Jan 25, 2012 at 12:20 AM, Daniel Holbert <dholbert@mozilla.com> wrote:
> On 01/24/2012 08:38 PM, Alex Mogilevsky wrote:
>>
>> There is a little bit of a chicken+egg problem here when 'float' is set on
>> inline element:
>>        1) 'float' makes the element block-level
>>        2) flexbox accepts the element as a flex item (because it is block
>> level) rather than wrapping it
>>        3) flexbox layout ignores 'float'
>>
>> That's how it works in IE.
>
>
> I'm not 100% sold on this... So for a <span> or an <i> element whose parent
> is a flexbox, the style "float:left" would be functionally identical to
> "display:block", as far as the rendering is concerned?
>
> If that's how it's supposed to work, it'd be useful if that process & logic
> were spelled out more clearly in the spec.
>
> My understood was more like "the flexbox itself doesn't establish a context
> for things to float in", and so the span would get wrapped in an anonymous
> block (along with any other contiguous inline non-atomic content
> (disregarding floats' effects on inline-ness)), and then floated to the left
> of the anonymous block.
>
> I could easily be misunderstanding, though. :)

I'm torn on this.  Right now, Flexbox determines whether to wrap or
not *before* block-in-inline splitting, but *after* table-fixup.  I'm
not certain if we should extract general principles from this or not.

I suppose we can go with the fact that table-fixup is required to
avoid exposing table-internal elements (which are neither block-level
nor inline-level, I guess?), but block-in-inline fixup isn't.  By this
principle, the fact that floats change the computed value of 'display'
should be taken into account only *after* item wrapping.

On the other hand, the item-wrapping algorithm needs to inspect the
value for 'display', and it's most consistent to say that this happens
at computed-value time.  The computed value of 'display', though, is
dependent on 'float', which means that a floated <span> should become
a block and be a proper flexbox item.

I think I like the second interpretation, as it's based on more stable
and widespread rules that should probably continue to work if we
introduce more things like floats, while the first interpretation is
based more on rules-of-thumb that will need manual attention whenever
something new in this class occurs.

~TJ

Received on Wednesday, 25 January 2012 18:51:20 UTC