Skip to content

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=321124 - #64188

Open
annevk wants to merge 1 commit into
web-platform-tests:masterfrom
annevk:wpt-export-for-webkit-321124
Open

annevk wants to merge 1 commit into
web-platform-tests:masterfrom
annevk:wpt-export-for-webkit-321124

Conversation

@annevk

@annevk annevk commented Oct 25, 2026

Copy link
Copy Markdown
Member

WebKit export from bug: [block-in-inline] Baseline of an inline-block whose last line box holds a block level box drops that line's offset

[block-in-inline] Baseline of an inline-block whose last line box holds a block level box drops that line's offset

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)

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=321124
WebKit-Canonical-Link: https://commits.webkit.org/318702@main

…ds a block level box drops that line's offset

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)

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=321124
WebKit-Canonical-Link: https://commits.webkit.org/318702@main

@wpt-pr-bot wpt-pr-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the WebKit project.

@annevk
annevk enabled auto-merge (rebase) October 25, 2026 08:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants