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

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/visudet/inline-block-baseline-with-block-in-inline-001-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/visudet/inline-block-baseline-with-block-in-inline-001.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/alignment/flex-align-baseline-line-clamp-001.tentative-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-align-baseline-line-clamp-001.tentative-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/baseline-source/baseline-source-first-001-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/baseline-source/baseline-source-last-001-expected.txt
    M LayoutTests/platform/glib/fast/overflow/line-clamp-expected.txt
    M LayoutTests/platform/ios/fast/overflow/line-clamp-expected.txt
    M LayoutTests/platform/mac/fast/overflow/line-clamp-expected.txt
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp

  Log Message:
  -----------
  [block-in-inline] Baseline of an inline-block whose last line box holds a 
block level box drops that line's offset
https://bugs.webkit.org/show_bug.cgi?id=321124

Reviewed by Antti Koivisto.

Follow-up to bug 321083, which fixed firstLineBaseline() only. 
lastLineBaseline() has the same defect and
needed a second change alongside it, which is why it was left out there.

An inline-block's baseline is the baseline of its last line box. When that line 
box holds a block level box,
LineLayout::lastLineBaseline() returned the block's own baseline without adding 
the block's offset within the
inline-block, so the content after the inline-block aligned to the *first* line 
instead:

    <div style="display: inline-block"><br><span><div>x</div></span></div>after

"after" sat at the top of the inline-block rather than 20px down. Legacy line 
layout gets this right - it
reports 32 where modern reported 14 on the reduction this came from.

Two changes are needed together:

- Add the block's logicalTop, matching RenderBlock::lastLineBaseline() and 
firstLineBaseline().
- Skip lines clamped away in the block direction. A line with no visible 
content is not the last line with
  content. A line holding a block level box is excluded from that skip: what is 
visible
  there is decided inside that block, which runs this same look-up on its own 
lines.

(fast/overflow/line-clamp.html <- visual progression)

* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::lastLineBaseline const):
* 
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/visudet/inline-block-baseline-with-block-in-inline-001.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/visudet/inline-block-baseline-with-block-in-inline-001-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/alignment/flex-align-baseline-line-clamp-001.tentative-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-align-baseline-line-clamp-001.tentative-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/baseline-source/baseline-source-last-001-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/baseline-source/baseline-source-first-001-expected.txt:
* LayoutTests/platform/glib/fast/overflow/line-clamp-expected.txt:
* LayoutTests/platform/ios/fast/overflow/line-clamp-expected.txt:
* LayoutTests/platform/mac/fast/overflow/line-clamp-expected.txt:

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



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

Reply via email to