W3C home > Mailing lists > Public > www-style@w3.org > October 2012

[css3-flexbox] possible-paradox in spec: effects of "float" on a table-component in a flex container?

From: Daniel Holbert <dholbert@mozilla.com>
Date: Tue, 23 Oct 2012 12:34:09 -0700
Message-ID: <5086F131.9030500@mozilla.com>
To: www-style list <www-style@w3.org>
Hi www-style,

I think I've found a paradox in the spec which needs some clarification.

Basically, the problem is with how the following line interacts with
table-fixup:
  #  ‘float’ and ‘clear’ have no effect on a flex item.
Source: http://dev.w3.org/csswg/css3-flexbox/#flex-containers

So -- let's start with a simple situation, with no floating:
    <div style="display: flex">
      <td>cell</td>
    </div>
To render that, we do table-fixup to generate an anonymous table-box.
The <td> element is definitely *not* a flex item -- its anonymous
table-ancestor is. Agreed? Cool.

NOW: Suppose we add style="float: left" to the <td> element. What
happens then?

The flexbox spec's "float has no effect" doesn't seem to apply, because
the <td> element isn't a flex item.  So presumably we should apply the
rules for floats from CSS 2.1 section 9.7: convert the <td>'s display
value to "block" and float the element (in what containing block...?)
BUT that causes problems:
 (a) now our td is display:block, so it *is* a flex item.  So now, the
"float has no effect" rule suddenly *is* applicable.  So maybe our
float-triggered display:block conversion should be reverted, to honor
that?  (But then it would no longer be a flex item, and float *would*
have an effect again... and around and around we go)

 (b) now we don't need the anonymous table wrapper anymore, so should we
still create it?

Among other things, the problem is that we can't easily implement "float
has no effect on flex items" because float's effect on computed style
happens *before* decided what is & isn't a flex item.

POSSIBLE RESOLUTION: I believe an earlier version of the spec said
something like:
  # float has no effect on a child of a flex container
  # except to change their "display" value.

If we switched back to that sort of language, then the problems I'm
bringing up would be resolved.  In particular -- if the spec said
"child" instead of "flex item" here, that'd prevent the circular
dependency / paradox of "<td> is not a flex item, so float applies and
makes it a block, which makes it a flex item, which means float
*doesn't* apply".  And the explicit mention of float's display-value
conversion would remove any ambiguity about whether a floated <td> child
still triggers table-fixup. (I don't think it should.)

Thanks,
~Daniel
Received on Tuesday, 23 October 2012 19:34:38 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:01 GMT