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

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

  Log Message:
  -----------
  [block-in-inline] Self collapsing block nested in an inline box loses its 
margin when the root has a border
https://bugs.webkit.org/show_bug.cgi?id=321087

Reviewed by Antti Koivisto.

LineBuilder::initialize() skips a pending margin when the margin state is still 
at the before side of the
block, on the grounds that it can collapse out through that edge. That is only 
half the condition.
RenderBlockFlow::MarginInfo says:

    bool canCollapseWithMarginBefore() const { return m_atBeforeSideOfBlock && 
m_canCollapseMarginBeforeWithChildren; }

When the root has a border or padding the margin cannot collapse through its 
before edge, so a self
collapsing block on a previous line has already committed it and the line has 
to move down by it. Skipping
it dropped the margin outright: the block painted below while the content 
following it stayed at the
container's top.

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

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



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

Reply via email to