Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c736c2ddd5659f8a63e6576519cb373a1e4cc1e9
      
https://github.com/WebKit/WebKit/commit/c736c2ddd5659f8a63e6576519cb373a1e4cc1e9
  Author: Alan Baradlay <[email protected]>
  Date:   2026-04-20 (Mon, 20 Apr 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-in-inline-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-in-inline-001.html
    M Source/WebCore/rendering/RenderBlockFlow.cpp

  Log Message:
  -----------
  [block-in-inline] margin-trim: block-start does not apply to blocks nested in 
inline boxes
https://bugs.webkit.org/show_bug.cgi?id=312683

Reviewed by Antti Koivisto.

Consider:

  <div style="margin-trim: block-start">
    <span>
      <div style="margin-top: 300px; height: 50px"></div>
    </span>
  </div>

The inner div is a block-in-inline - a block box inside an inline
element. Its 300px top margin should be trimmed because it is the
first block-level box in the outer div's formatting context and its
margin is adjacent to the outer div's block-start edge (the empty
span contributes no space above it).

When IFC encounters the block-in-inline, it calls back to
layoutBlockChildFromInlineLayout which calls layoutBlockChild. But
marginTrimBlockStart was never set on the layout state, so the
child's margin was not trimmed.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-in-inline-001-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-block-in-inline-001.html:
 Added.
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutBlockChildFromInlineLayout):

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



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

Reply via email to