Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 30f62637197dd0f430cf2e00e78ac4cdfc377c52
      
https://github.com/WebKit/WebKit/commit/30f62637197dd0f430cf2e00e78ac4cdfc377c52
  Author: Alan Baradlay <[email protected]>
  Date:   2026-10-02 (Fri, 02 Oct 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/fast/inline/line-clamp-discarded-content-assert-expected.txt
    M LayoutTests/platform/glib/TestExpectations
    M Source/WebCore/layout/formattingContexts/inline/AbstractLineBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h
    M 
Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineTypes.h
    M Source/WebCore/layout/formattingContexts/inline/LineLayoutResult.h
    M 
Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp
    M 
Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.h

  Log Message:
  -----------
  [line-clamp] Place the block ellipsis during line breaking
https://bugs.webkit.org/show_bug.cgi?id=325282
<rdar://problem/188393991>

Reviewed by Antti Koivisto.

<div style="line-clamp: 2; width: 100px">
  first line <span style="white-space: nowrap">this does not fit next to the 
ellipsis</span>
</div>

The last visible line ends with the block ellipsis. css-overflow-4 makes room 
for it by moving content
to the next line "as if wrapping", ignoring wrap opportunities from 
overflow-wrap and the ones nowrap takes away.
When all the content has to move, the line keeps only the ellipsis (and a 
strut).
https://drafts.csswg.org/css-overflow-4/#block-ellipsis

We used to truncate the line's display boxes after line breaking (like 
text-overflow), so the "moved"
content still reported its geometry on the clamped line.
Now LineBuilder reserves the ellipsis width on that line and 
InlineContentBreaker wraps what does not fit, even off an empty line.
The display step only places the ellipsis after the content.
Legacy -webkit-line-clamp and text-overflow keep using display time truncation.

* LayoutTests/TestExpectations:
* LayoutTests/fast/inline/line-clamp-discarded-content-assert-expected.txt: 
"PASS" no longer fits next to the ellipsis.
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/layout/formattingContexts/inline/AbstractLineBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
(WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const):
* Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h:
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::createDisplayContentForInlineContent):
(WebCore::Layout::InlineFormattingContext::createDisplayContentForLineFromCachedContent):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp:
(WebCore::Layout::InlineFormattingUtils::leadingInlineItemPositionForNextLine):
(WebCore::Layout::InlineFormattingUtils::blockEllipsisForLine const):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::layoutInlineContent):
(WebCore::Layout::LineBuilder::initialize):
(WebCore::Layout::LineBuilder::placeInlineAndFloatContent):
(WebCore::Layout::LineBuilder::handleInlineContent):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineTypes.h:
* Source/WebCore/layout/formattingContexts/inline/LineLayoutResult.h:
(WebCore::Layout::LineLayoutResult::inflowContentType const):
* 
Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
(WebCore::Layout::trailingBlockEllipsis):
(WebCore::Layout::InlineDisplayLineBuilder::placeTrailingEllipsisIfNeeded): 
Renamed from applyEllipsisIfNeeded.
* 
Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.h:

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



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

Reply via email to