W3C home > Mailing lists > Public > www-style@w3.org > June 2015

Re: [css-containment] "contain:layout" mixed with "display:inline" and block-in-inline

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 10 Jun 2015 15:36:52 -0700
Message-ID: <CAAWBYDCKGNMuCB=p=pQQNcQn_xEJNAQY18O3t6FT8y3YnB20pA@mail.gmail.com>
To: Daniel Holbert <dholbert@mozilla.com>
Cc: www-style list <www-style@w3.org>
On Tue, Jun 9, 2015 at 1:34 PM, Daniel Holbert <dholbert@mozilla.com> wrote:
> What's supposed to happen if I have content like:
>
>   <span style="display:inline;contain: layout">
>     aaa
>     <div style="display:block">bbb</div>
>     ccc
>   </span>
>
>
> In particular: should there be a block-in-inline split, to pull the
> <div>'s box out of its inline-level parent element?
>
> (and if not: does that mean we end up with a block whose actual box-tree
> parent is "display:inline"?  Wouldn't that break CSS's assumptions about
> block-level boxes having block-level parents?)
>
> The spec text about layout containment is:
> http://dev.w3.org/csswg/css-containment/#layout-containment
>
> Quoting:
>   # 1. When laying out the containing element,
>   # it must be treated as having no contents.
>
> (This sounds like no split should happen, because we ignore the div when
> layout out the span.)
>
> ...and:
>  # 2. The element must be a formatting context.
>
> I don't know what this actually is trying to say. At first I thought it
> might mean the "display:inline" would end up being block-inside or
> something, but then I rediscovered that there is such a thing as an
> "inline formatting context". So I don't think (2) really does anything
> special for this case.
>
> Perhaps we need "contain" to blockify the display value? (similar to
> floats, abspos stuff, and flex/grid-item)

I somehow never considered this.

Yeah, we'll need to either blockify, or at least
formatting-contextify, which would turn this into an inline-block.

Actually, we need to formatting-contextify blocks, too.  Otherwise the
internals of the block *can* affect the layout of things outside, via
pushing later floats around.

Since we have to FC blocks, and I think FC is *sufficient* to fix
inlines, we should probably just go for that, rather than
blockification.

(Though I then need to define what it means to FCify a ruby, I guess.
Maybe it falls back to blockifying when it can't directly FCify the
display type.)

~TJ
Received on Wednesday, 10 June 2015 22:37:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:54 UTC