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

[css3-flexbox] We need a BFC for "intended-to-be-replaced" flex items like <object>, <img>

From: Daniel Holbert <dholbert@mozilla.com>
Date: Mon, 21 May 2012 14:48:34 -0700
Message-ID: <4FBAB832.3000206@mozilla.com>
To: www-style list <www-style@w3.org>
Hi www-style,

I believe the new "elements that want to be replaced will form flex
items" magic is still unclear on (at least) one thing.

( ED spec reference: http://dev.w3.org/csswg/css3-flexbox/#flex-items )

Consider this content, where the <object> doesn't load anything, which
makes it render its contents (naked text in this case):

  <div style="display: flex>
   <object>
     This is a paragraph of text.
     [...]
     Here ends the paragraph of text.
   </object>
  </div>

Presumably we'd expect these characteristics:
 (1) If we add style="width: 100px" on the <object>, it should honor
that width, just as any other flexbox item would.
 (2) If we add style="height: 100px" on the <object>, it should honor
that height, just as any other flexbox item would.
 (3) The <object>'s box should line-wrap its contents (in this case, a
paragraph of text), as if it were a block.

However -- since the <object> is display:inline (by default), it will
actually generate an inline-level box, which won't have any of the above
characteristics.  That's bad.

The <object> really needs a block formatting context for its contents to
render into.  The spec doesn't currently say whether or how it would get
one of those, though.

I think we need to somehow treat the <object> as if it were really
"display:block" (or perhaps "display:inline-block", depending on what we
want the baseline to be).

Does this make sense?  Moreover, would we want to make its display value
*actually compute* to 'block', too?  (I'm not sure whether it'd be more
magical/surprising/hacky to have the display value actually change, or
for us to just behave as if it had changed without actually changing it...)

~Daniel

P.S. Alternate strawman suggestion: We also could say that the <object>
ends up in its own special dedicated anonymous flex item.  That would
give it a block to render into. HOWEVER, it would break all of the
various flex / flex-item-align / etc. properties (since those have no
effect on things inside of anonymous flex items).  We want those
properties to work -- so I don't think we want to do that.
Received on Monday, 21 May 2012 21:49:19 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:54 GMT