Bug 197162

Summary: margin-top is ignored on elements with zero-height (and clear set) if they appear after floating elements
Product: WebKit Reporter: Brad Andalman <bya>
Component: Layout and RenderingAssignee: alan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, bfulgham, koivisto, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari 12   
Hardware: Mac   
OS: macOS 10.14   
Attachments:
Description Flags
The html that exhibits the bug
none
A screenshot of Chrome which does NOT exhibit the bug
none
The broken behavior in Safari on Ventura
none
Test reduction
none
Patch none

Brad Andalman
Reported 2019-04-22 09:47:48 PDT
Created attachment 367944 [details] The html that exhibits the bug If you have elements that have a height of 0 but with margin-top and clear specified, then the margin-top will be ignored for all elements that appear after a floating element. It's worth reiterating that this happens whenever a zero-height element appears – even if one appears quite a bit later in the page, and far away from a floating element. I've included a simple html file that illustrates this behavior. As attached, the file includes a "spacer" div with "clear: both" specified. In the html, the spacer appears between each paragraph. When rendered in Safari, the spacer appears between each paragraph before the floating element, but completely disappears after. Though I've reported that this bug is in Safari 12, it also manifests in Safari Technology Preview. In Chrome, the page renders as we'd expect (space appears between each paragraph, always). If you comment out the "clear:both" then the space between the paragraphs appears in Safari. That means we lose the clear behavior, of course.
Attachments
The html that exhibits the bug (2.26 KB, text/html)
2019-04-22 09:47 PDT, Brad Andalman
no flags
A screenshot of Chrome which does NOT exhibit the bug (152.83 KB, image/png)
2019-04-22 09:48 PDT, Brad Andalman
no flags
The broken behavior in Safari on Ventura (366.87 KB, image/png)
2023-03-20 10:55 PDT, Brad Andalman
no flags
Test reduction (237 bytes, text/html)
2023-03-20 11:27 PDT, alan
no flags
Patch (8.36 KB, patch)
2023-03-20 20:31 PDT, alan
no flags
Brad Andalman
Comment 1 2019-04-22 09:48:38 PDT
Created attachment 367945 [details] A screenshot of Chrome which does NOT exhibit the bug
Radar WebKit Bug Importer
Comment 2 2019-04-22 10:35:07 PDT
Ahmad Saleem
Comment 3 2023-03-17 17:33:01 PDT
If I am not wrong, I am not able to reproduce this in WebKit ToT (261814@main), is this IFC progression? @Alan?
alan
Comment 4 2023-03-18 06:10:46 PDT
I wish there was a "broken" screenshot too. I don't seem to be able to reproduce it either.
Brad Andalman
Comment 5 2023-03-20 10:55:54 PDT
Created attachment 465524 [details] The broken behavior in Safari on Ventura I’m attaching a screenshot of the broken behavior using Safari on Ventura.
alan
Comment 6 2023-03-20 11:07:22 PDT
(In reply to Brad Andalman from comment #5) > Created attachment 465524 [details] > The broken behavior in Safari on Ventura > > I’m attaching a screenshot of the broken behavior using Safari on Ventura. Very much appreciated! Let me go back and check trunk again.
alan
Comment 7 2023-03-20 11:14:26 PDT
Oh that spacer! Yeah, ok, this bug has clearly not been fixed. Reopening.
Brad Andalman
Comment 8 2023-03-20 11:15:07 PDT
Oh, bummer! I got excited. Thanks for double-checking, though.
alan
Comment 9 2023-03-20 11:21:29 PDT
(In reply to Brad Andalman from comment #8) > Oh, bummer! I got excited. > > Thanks for double-checking, though. :| looking into it now.
alan
Comment 10 2023-03-20 11:27:39 PDT
Created attachment 465525 [details] Test reduction
alan
Comment 11 2023-03-20 20:31:09 PDT
Brad Andalman
Comment 12 2023-03-21 09:14:46 PDT
Wow! Thanks, zalan!
Ahmad Saleem
Comment 13 2023-03-21 09:50:23 PDT
Alan -> WebKit Layout Super Hero for rescue on another bug.. Thanks Alan!!
EWS
Comment 14 2023-03-21 10:47:47 PDT
Committed 261926@main (208379f2adf1): <https://commits.webkit.org/261926@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 465533 [details].
Note You need to log in before you can comment on or make changes to this bug.