Blocks that create a new block formatting context are not self-collapsing. Per http://www.w3.org/TR/CSS2/box.html#collapsing-margins the top and bottom margins of a block that has no content and otherwise no height of its own can only collapse together if the box doesn't establish a block formatting context. We already have a function that detects when a block is creating a new block formatting context, so let's use it to detect when we shouldn't collapse margins.
Created attachment 242918 [details] Patch
Comment on attachment 242918 [details] Patch Attachment 242918 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/4624583579664384 New failing tests: fast/multicol/span/span-margin-collapsing.html
Created attachment 242921 [details] Archive of layout-test-results from ews100 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 242918 [details] Patch Attachment 242918 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5145176028741632 New failing tests: fast/multicol/span/span-margin-collapsing.html
Created attachment 242925 [details] Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-13 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
(In reply to comment #4) > New failing tests: > fast/multicol/span/span-margin-collapsing.html Lets deal with this before reviewing the patch. Maybe clear the review flag until then?
Comment on attachment 242918 [details] Patch yeah, let's clear the review flag while I'm investigating why it affects the multicolumn tests.
(In reply to comment #6) > (In reply to comment #4) > > New failing tests: > > fast/multicol/span/span-margin-collapsing.html > > Lets deal with this before reviewing the patch. Maybe clear the review flag > until then? According to the specs (http://dev.w3.org/csswg/css-multicol/#valuedef-all): "The element spans across all columns of the nearest multicol ancestor in the same block formatting context. The element spans across all columns. Content in the normal flow that appears before the element is automatically balanced across all columns before the element appears. **The element establishes a new block formatting context**." Elements creating a new formatting context should not be self-collapsing elements, so I think we would need to rebaseline this test.
Any feedback on this ?
By taking test case from attached patch and then changing into JSFiddle: Link - https://jsfiddle.net/kuazqvn4/show I am not able to see 'red' to indicate failure in Safari 15.6 on macOS 12.5 but both the browsers do show "red" in various different places. I am not sure whether Safari implementation is accurate or something is wrong with test case or nothing at all. But just wanted to share updated status, please mark this bug accordingly. Thanks!
<rdar://problem/97694180>