Open Bug 1487927 Opened 6 years ago Updated 2 years ago

margin-bottom in multi-column renders differently in Firefox and Chrome

Categories

(Core :: Layout: Columns, defect, P3)

defect

Tracking

()

People

(Reporter: TYLin, Unassigned)

References

Details

Attachments

(3 files)

See the attached test case. It seems Firefox ignores margin-bottom set on the children in columns.
Attached image Firefox.png
Attached image Chrome.png
Mats, do you know which rendering is correct? Also, is NS_BLOCK_MARGIN_ROOT bit [1] set on nsColumnSetFrame has effect on rendering? It seems the bit is only used in nsBlockFrame and BlockReflowInput. [1] https://searchfox.org/mozilla-central/rev/43969de34f5d4b113133d090f024e5eed7a82af0/layout/generic/nsColumnSetFrame.cpp#105
Flags: needinfo?(mats)
It looks like we're only ignoring *some* of the margin. Setting the margin to 0 causes it to go away. I suspect what's happening is that the column-balancing code is getting confused because we don't know how to break in the middle of the margin and continue to apply the remainder of the margin in the next column. (It's possible that the CSS spec even says that the margin shouldn't get continued...) I would have expected NS_BLOCK_MARGIN_ROOT to be set on the anonymous column boxes inside the multicol, which are blocks. It indeed shouldn't be set on the columnset.
https://drafts.csswg.org/css-break/#break-margins says: When an unforced break occurs between block-level boxes, any margins adjoining the break truncate to the remaining fragmentainer extent before the break, and are truncated to zero after the break. When a forced break occurs there, adjoining margins before the break are truncated, but margins after the break are preserved. Cloned margins are always truncated to zero on block-level margins. It's not clear whether the "between block-level boxes" also applies to after the last block-level child, though.
I believe Bug 1421105 will make this bug noticeable because multicol-nested-margin-002.xht start to fail after enabling "layout.css.column-span.enabled".
Blocks: column-span
Flags: needinfo?(mats)
See Also: → 1467444
No longer blocks: column-span
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: