Bug 139446

Summary: Blocks that create a new block formatting context are not self-collapsing.
Product: WebKit Reporter: Javier Fernandez <jfernandez>
Component: Layout and RenderingAssignee: Javier Fernandez <jfernandez>
Status: NEW ---    
Severity: Normal CC: ahmad.saleem792, ap, bfulgham, buildbot, commit-queue, darin, esprehn+autocc, glenn, hyatt, jfernandez, kondapallykalyan, rniwa, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
buildbot: commit-queue-
Archive of layout-test-results from ews100 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 none

Description Javier Fernandez 2014-12-09 07:07:47 PST
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.
Comment 1 Javier Fernandez 2014-12-09 07:27:22 PST
Created attachment 242918 [details]
Patch
Comment 2 Build Bot 2014-12-09 08:12:20 PST
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
Comment 3 Build Bot 2014-12-09 08:12:24 PST
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 4 Build Bot 2014-12-09 08:37:06 PST
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
Comment 5 Build Bot 2014-12-09 08:37:09 PST
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
Comment 6 Darin Adler 2014-12-09 08:58:44 PST
(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 7 Javier Fernandez 2014-12-10 03:37:21 PST
Comment on attachment 242918 [details]
Patch

yeah, let's clear the review flag while I'm investigating why it affects the multicolumn tests.
Comment 8 Javier Fernandez 2014-12-10 04:29:34 PST
(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.
Comment 9 Javier Fernandez 2014-12-18 05:45:00 PST
Any feedback on this ?
Comment 10 Ahmad Saleem 2022-07-27 10:15:17 PDT
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!
Comment 11 Radar WebKit Bug Importer 2022-07-27 17:57:29 PDT
<rdar://problem/97694180>