Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c29a9dd11c8d98c416f6ea639bc02ef829f1eb84
      
https://github.com/WebKit/WebKit/commit/c29a9dd11c8d98c416f6ea639bc02ef829f1eb84
  Author: Alan Baradlay <[email protected]>
  Date:   2026-05-22 (Fri, 22 May 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-baseline-with-block-in-inline-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-baseline-with-block-in-inline-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-baseline-with-block-in-inline.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-last-baseline-skips-non-contributing-block-in-inline-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-last-baseline-skips-non-contributing-block-in-inline-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-last-baseline-skips-non-contributing-block-in-inline.html
    M Source/WebCore/layout/integration/LayoutIntegrationBoxGeometryUpdater.cpp

  Log Message:
  -----------
  [block-in-inline] inline-block baseline should fall back to bottom margin 
edge when content inside is block-in-inline only
https://bugs.webkit.org/show_bug.cgi?id=315324

Reviewed by Antti Koivisto.

<span>text
  <div style="display: inline-block; width: 320px; height: 100px;">
    <span><div style="display: block; width: 320px; height: 
100px;"></div></span>
  </div>
</span>

The "text" should sit at the bottom of the inline-block. The inline-block's
baseline should be its bottom margin edge per CSS 2.1 10.8.1 (and CSS Inline 3
atomic-inline baseline synthesis), since the only content is block-in-inline
and there are no in-flow line boxes with a baseline. Instead the "text" sat
at the top of the inline-block.

In LayoutIntegrationBoxGeometryUpdater::baselineForBox, the RenderBlockFlow
path called LineLayout::lastLineBaseline() which correctly returns nullopt
when no line contributes a baseline (e.g. when the only content is a
block-in-inline whose inner block is empty). The integration was substituting
0 via .value_or(0_lu) and reporting the inline-block's top edge as its
baseline.

Drop the .value_or(0_lu) so the nullopt propagates: setIntegrationBaseline's
existing fallback then synthesizes margin-box-bottom for atomic inlines (per
css-inline-3 A.3), and lastInflowBoxBaseline's sibling walk skips the
non-contributing child and continues to the previous in-flow block-level
sibling (per css-align-3 ยง11.5).

LineLayout::lastLineBaseline already recurses into block-in-inline via
blockLevelBoxForLine, so when the inner block does contribute a last baseline
the inline-block aligns to it (covered by 
css/css-lists/list-and-block-in-inline.html)

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-baseline-with-block-in-inline-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-baseline-with-block-in-inline-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-baseline-with-block-in-inline.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-last-baseline-skips-non-contributing-block-in-inline-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-last-baseline-skips-non-contributing-block-in-inline-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/inline-block-last-baseline-skips-non-contributing-block-in-inline.html:
 Added.
* Source/WebCore/layout/integration/LayoutIntegrationBoxGeometryUpdater.cpp:
(WebCore::LayoutIntegration::baselineForBox):

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



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

Reply via email to