Skip to content

[css-overflow-4] Unexpected behavior of continue: discard on multicolumn containers with spanners #8721

@andreubotella

Description

@andreubotella

The definition of continue: discard in css-overflow-4, section 5.3 (not the one in appendix A) says that, for a multicolumn container, overflow columns are discarded, which is to say they are not laid out or painted.

Consider the following case, though:

.multicol {
  columns: 3;
  continue: discard;
}
.multicol p {
  break-after: column;
  break-inside: avoid;
}
.spanner {
  column-span: all;
}
<div class="multicol">
  <p>Column 1</p>
  <p>Column 2</p>
  <p>Column 3</p>
  <p>Overflow column</p>
  <div class="spanner">Spanner</div>
</div>

In the case of block containers, or of region breaks in a multicolumn container, continue: discard will discard the remainder of the container, which can be done in implementations by stopping layout at the end of a fragment. However, with overflow columns before a spanner, the layout must resume at the spanner.

My understanding is that the layout at the spanner, and at any further multicol lines after it, is independent from the layout the overflow columns would have, so there is no actual contradiction. I think this could be implemented correctly by having multicol line boxes in the box tree that would end before a spanner, such that only the remainder of the line box would be discarded:

MulticolBox
  MulticolLineBox
    BlockBox ("Column 1")
    BlockBox ("Column 2")
    BlockBox ("Column 3")
    BlockBox ("Overflow column")
  MulticolSpanner
  MulticolLineBox
    ...

But this would be unexpected behavior all the same, since in terms of the DOM tree there would be a range that is skipped by layout. And Chromium's LayoutNG implementation of multicol, at the very least, doesn't use multicol line boxes – it instead treats spanners as forcing a break in the multicol line.

cc @frivoal @bfgeek

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Wednesday Afternoon

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions