Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dd58efd5acc56ff28293307f49cee0caba5be914
      
https://github.com/WebKit/WebKit/commit/dd58efd5acc56ff28293307f49cee0caba5be914
  Author: Alan Baradlay <[email protected]>
  Date:   2026-08-24 (Mon, 24 Aug 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/normal-flow/margin-collapse-through-block-in-inline-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/normal-flow/margin-collapse-through-block-in-inline-001-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/normal-flow/margin-collapse-through-block-in-inline-001.html
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp

  Log Message:
  -----------
  [block-in-inline] Margin does not collapse after a self collapsing block 
level box on a line
https://bugs.webkit.org/show_bug.cgi?id=322338
<rdar://problem/185598333>

Reviewed by Antti Koivisto.

A block level box on a line is handed to block layout at the line's top, and 
block layout applies the pending
margin from the container's own position, so LineBuilder::handleBlockContent 
takes that margin back off the line
top first - but only when the margin was no longer at the before side of the 
block, while the line was advanced by
it whenever the margin could not collapse out through the root's before edge. 
With a border or padding on the
root the two disagree: the line top already holds the margin and block layout 
adds it again, so
<span><div style="margin-top:100px"></div></span><div> puts the second block 
200px down instead of 100px. Make
the rollback test the condition the advance already uses.

* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::handleBlockContent):
* 
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/normal-flow/margin-collapse-through-block-in-inline-001.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/normal-flow/margin-collapse-through-block-in-inline-001-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/normal-flow/margin-collapse-through-block-in-inline-001-expected.html:
 Added.

Canonical link: https://commits.webkit.org/319697@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to