Bug 1810806 [wpt PR 38013] - Allow un-balanced columns even if column size is unconst...
commitee4c3fb1bfbb4cd667c132144d0da8de4a26103c
authorMorten Stenshorne <mstensho@chromium.org>
Thu, 19 Jan 2023 05:14:56 +0000 (19 05:14 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Fri, 20 Jan 2023 15:08:23 +0000 (20 15:08 +0000)
treed0fc89f8668479ffb9450fd83adf9a184626a9a6
parent5f1fd09ecee5cb2e5e0da5b0049dff1b2516ead6
Bug 1810806 [wpt PR 38013] - Allow un-balanced columns even if column size is unconstrained., a=testonly

Automatic update from web-platform-tests
Allow un-balanced columns even if column size is unconstrained.

Back in the days, the spec actually said that column-fill:auto should be
disregarded if block-size was unconstrained.  But this was changed a
long time ago. The last version of the spec said this was
https://www.w3.org/TR/2011/CR-css3-multicol-20110412/#cf :
"In continuous media, this property will only be consulted if the length
of columns has been constrained. Otherwise, columns will automatically
be balanced."

This requirement is gone here:
https://www.w3.org/TR/2017/WD-css-multicol-1-20171005/#cf

With this change, we'll only balance columns if column-fill is
'balance', and not if column-fill is 'auto'.

There's one exception: We still balance content before a column spanner
(regardless of what the column-fill property says). In addition to
making sense, it's a spec requirement:
https://www.w3.org/TR/css-multicol-1/#valdef-column-span-all

Gecko has been doing this for years already.

If block-size is unconstrained and column-fill is auto, it still means
that we need to know the column block-size before laying out. The new
test multicol-fill-auto-004.html illustrates this. All columns in a row
needs to have the same block-size. To achieve this we just re-use the
same mechanism that we use for the initial column balancing pass, except
that we don't assume any implicit breaks. This called for a rename of
CalculateBalancedColumnBlockSize() to ResolveColumnAutoBlockSize(), with
a new parameter that says whether or not to assume implicit/soft breaks.

If an unconstrained column-fill:auto multicol container is nested inside
another multicol container that is to be balanced, we also need to
balance the inner multicol in the initial column balancing pass of the
outer multicol, so that the outer columns don't get overstretched. The
new test multicol-fill-balance-026.html illustrates this.

This CL fixes 3 existing tests, in addition to the new test
columnfill-auto-max-height-003.html . The two other new tests pass
without this CL as well.

Bug: 1156312, 967329
Change-Id: If41c50376fcd3a84457d603a5cb3fecb2aa2f917
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4173395
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: Alison Maher <almaher@microsoft.com>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1093508}

--

wpt-commits: 509b63ccdbeb5db07a222f6c005581f361b26948
wpt-pr: 38013
testing/web-platform/tests/css/css-multicol/columnfill-auto-max-height-003.html [new file with mode: 0644]
testing/web-platform/tests/css/css-multicol/multicol-fill-auto-004.html [new file with mode: 0644]
testing/web-platform/tests/css/css-multicol/multicol-fill-balance-026.html [new file with mode: 0644]