-
Notifications
You must be signed in to change notification settings - Fork 719
[css-multicol] Definition of adjacent spanners, when to create column boxes #6265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It seems we should definitely make a decision and add something about the abspos case. I'll agenda+ it. I think my preference would be that if there is an abspos item, it's out of flow and therefore the spanners are adjacent to each other and margins should collapse. That seems like the behavior I'd expect as an author. Safari is doing what current Chromium does, collapsing the margins. CodePen: https://codepen.io/rachelandrew/pen/9be69994f15df720cd5b920cfc5d2c10 |
Note that margins do collapse in regular block layout, when there's an abspos element separating two adjacent blocks, as shown here: .square-with-margin {
margin: 50px;
height: 50px;
width: 50px;
}
.blue { background: blue; }
.teal { background: teal; }
.abs { position: absolute; } HTML: <div class="square-with-margin blue">div>
<div class="abs">hellodiv>
<div class="square-with-margin teal">div> So at first glance, I think I'd expect the same collapsing behavior from spanners as well. |
Then again, abspos descendants do affect a containing multicol container in special ways; see issue #6279 - abspos descendants affect column balancing in browsers (but should they?). Should (contained) OOFs trigger creation of column boxes? I suppose that answer would determine whether a spanner before and after should have their margins collapsed. |
I agree the problem reduces to the above statement. Firefox currently always triggers the creation of column boxes to contain non-column-span elements, whether they are absolutely positioned or not. So in the original example, the margin of #s1 and #s2 not collapsing is just a consequence that there's a column box in between them. |
The CSS Working Group just discussed
The full IRC log of that discussion |
If there's column spanner A, then some out-of-flow content not part of the fragmentation context, then another spanner B, the block-end margin of spanner A should collapse with the block-start margin of spanner B, as no columns should be created for the out-of-flow content (as far as the spec is concerned). See w3c/csswg-drafts#6265 In our implementation we DO create column fragments for such out-of-flow content, though, as we need this to let the OOFs bubble all the way up to their containing block. Therefore, let spanner margins collapse through such "empty" column rows. We'll now update the intrinsic block-size of the multicol and reset the margin strut only of the column row is considered to be non-empty. As a consequence of this, we need to avoid using intrinsic_block_size_ in some cases, but rather require that a row offset be supplied (it's actually quite tempting to just remove intrinsic_block_size_ completely as a member, since it's hard to determine when it's safe to use and not). This fixes two failing tests. Note that there's still one test failing (fast/multicol/relpos-becomes-static-has-abspos.html) because of this problem. Note that there was actually remnants of code that attempted to deal with this, but it got messed up by CL:2410242. Bug: 1151880 Change-Id: I990d42f7b4661bac50ad52f65d40d902cb79249e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2998709 Commit-Queue: Morten StenshorneReviewed-by: Ian Kilpatrick Cr-Commit-Position: refs/heads/master@{#897948}
Should "adjacent spanners" be defined in more detail? Here's what we have today:
https://drafts.csswg.org/css-multicol/#spanning-columns
So it looks like a column box between two spanners will prevent them from being adjacent, but when exactly do we create column boxes?
Are #s1 and #s2 adjacent spanners? Not if #abs causes a column box to be created, for sure, but should it? If it shouldn't, should we still treat #s1 and #s2 as adjacent?
Browsers don't agree. Blink and EdgeHTML draw a 100x100 square (i.e. adjacent). Gecko draws a 100x150 rectangle (i.e. not adjacent). Currently the new fragmentation engine that we're working on in Blink behaves like Gecko, but this is merely an outcome of implementation details, and not a conscious choice.
The text was updated successfully, but these errors were encountered: