Re: [csswg-drafts] [css-contain-3] Ancestor Layout Loops with Single-Axis Containment (#6426)

> I'm curious how this solution (Ian's comment above) looks for WebKit and Gecko? This is being proposed for `contain: inline-size` specifically

So if I'm understand correctly, the proposed solution is just to let the following behavior sort of naturally fall out (with no explicit fixup/band-aids needed):
 (1) A `contain:inline-size` container-query-targeted element (let's call this element "foo") gets laid out with a particular inline-size (provided by its parent)
 (2) At this point in layout, Foo can resolve styles for its subtree (based on the container query); then it proceeds to lay its subtree out, figures out its block size, and reports that up to its parent.
 (3) The parent now changes its mind about the inline-size that it provided before (e.g. due to now needing to show a scrollbar, or realizing that floats will intersect badly, etc) and tells Foo to lay itself out again with a new inline size.
 (4) Foo re-resolves its container-query-dependent styles and lays out its subtree again. It happens to now be small enough that the parent might reconsider its decision (e.g. no scrollbar needed after all, or it looks like it could move to an earlier location amidst floats, etc). But the parent doesn't actually get that opportunity.
 (5) So: at the end of this layout, we've got a somewhat-inconsistent-looking layout (where e.g. a scrollbar is visible even though there's no overflow, or where Foo is placed further down than it looks like it would need to be amidst floats, etc)

I think this seems ~fine, though I suspect we may have to go through this same dance on every incremental layout for any change that dirties any nearby boxes.

-- 
GitHub Notification of comment by dholbert
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6426#issuecomment-960032102 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 3 November 2021 20:52:34 UTC