-
Notifications
You must be signed in to change notification settings - Fork 717
[css-break][css-floats] Do fragments float independently? #4434
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
Test-case in a viewable format: https://bugzilla.mozilla.org/attachment.cgi?id=9102664 |
Since there's only one empty left-float, only one page gets pushed to the right. This is a deeper issue which as far as I can tell is not defined in the specification, see w3c/csswg-drafts#4434 for an example with multicol. This fixes the print issue on Firefox by floating the content to the right, which produces the desired layout and prevents overlapping the table of contents.
What Gecko does makes sense. Blink does what it does due to implementation limitations. Essentially, the old Blink engine doesn't understand block fragments (the boxes are just tall strips sliced into fragments during painting and hit-testing). LayoutNG fixes this, but NG block fragmentation hasn't shipped yet. Positioning and sizing each fragment individually makes sense to me - especially since we may have variable inline-size fragmentainers (such as regions or named pages). |
So I remembered Gecko code that I thought tried to position later fragments of floats based on where (in the inline-axis) they were in earlier fragments. But maybe I'm misremembering. I'd also note that the spec should probably go into more detail on what the rules for positioning of floats mean in the presence of fragmentation. The Gecko implementation tries to interpret them, but it should probably be clearer. For example:
|
Since there's only one empty left-float, only one page gets pushed to the right. This is a deeper issue which as far as I can tell is not defined in the specification, see w3c/csswg-drafts#4434 for an example with multicol. This fixes the print issue on Firefox by floating the content to the right, which produces the desired layout and prevents overlapping the table of contents.
Related: https://www.w3.org/TR/css-break-3/#breaking-boxes I think Gecko's behavior is implied in “Layout is performed per-fragmentainer”, but it's not entirely clear. Particularly in light of your examples, it might make more sense to maintain float offsets as if the float that ended is paginated for as long as there are floats stacked alongside it that paginate... |
The one other thing I'd note is that the rules for fragmenting floats should probably makes sense in a situation where the fragmentainers are different sizes. I think this can happen today with |
The new Blink fragmentation engine shipped in Chrome 102 (almost two years ago), and there's now interop between Gecko and Blink, now that Blink actually performs layout per-fragmentainer. WebKit still behaves like Chrome < 102. |
cc/ #3407.
Consider this test-case:
Should there be a gap between the two columns?
Gecko floats each fragment individually, so the tall blue element's second fragment floats to the left and thus there is no gap between the two columns.
It's not clear to me what is Chromium / WebKit doing, but off-hand I'd expect Gecko's behavior.
That being said, this causes issues in Gecko when printing, when people put fixed positioned stuff inside the other floats, and fixed-positioned elements do appear in multiple pages (and thus content overlaps).
/cc @fantasai @dbaron @aethanyc @MatsPalmgren @mstensho (in case any of you have strong opinions)
A description of what Blink is doing would be useful here.
The text was updated successfully, but these errors were encountered: