Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 73f2c8612940176c11bc6312e3a7155a58b00b33
      
https://github.com/WebKit/WebKit/commit/73f2c8612940176c11bc6312e3a7155a58b00b33
  Author: Christian Biesinger <[email protected]>
  Date:   2026-10-14 (Wed, 14 Oct 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/css-grid-layout/subgrid-continue-collapse-expected.html
    A LayoutTests/fast/css-grid-layout/subgrid-continue-collapse.html
    A LayoutTests/fast/css-grid-layout/subgrid-continue-discard-expected.html
    A LayoutTests/fast/css-grid-layout/subgrid-continue-discard.html
    M Source/WebCore/css/parser/CSSPropertyParserCustom.h
    M Source/WebCore/rendering/LineClampUpdater.cpp
    M Source/WebCore/rendering/LineClampUpdater.h
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBlockFlow.cpp

  Log Message:
  -----------
  [line-clamp] Make continue: collapse clamp, and set it from line-clamp
https://bugs.webkit.org/show_bug.cgi?id=327018

Reviewed by Alan Baradlay.

continue: collapse is parsed but behaves like the initial value, and the 
line-clamp shorthand sets continue: discard
instead of collapse [1]. The line clamp implementation hides the content after 
the clamp point and leaves it out of
the box's automatic block size, which is what collapse is specified to do [2], 
while discard is specified to turn the
box into a fragmentation container.

Make collapse behave like discard does today, and have line-clamp set continue: 
collapse as specified. This changes:

1. The computed value of continue when line-clamp is specified: it is now 
collapse instead of discard. The rendering
   of line-clamp does not change, since collapse and discard are now laid out 
the same.
2. The behavior of continue: collapse when specified by the author, which used 
to be ignored: the box establishes an
   independent formatting context and is a line-clamp container, so it clamps 
after max-lines lines, or at its
   height or max-height when max-lines is auto.

Both changes are behind the CSSLineClampEnabled preference, since line-clamp 
and continue are only parsed when it is enabled.

continue only applies to block containers (and multicol containers), so make 
neither collapse nor discard establish an
independent formatting context on other boxes. Before, continue: discard on a 
subgrid stopped it from being a subgrid.

This also lets continue: -webkit-legacy (as set by -webkit-line-clamp) be laid 
out "identically to collapse" later on.

[1] https://drafts.csswg.org/css-overflow-4/#line-clamp
[2] https://drafts.csswg.org/css-overflow-4/#valdef-continue-collapse

* LayoutTests/TestExpectations: continue-001.html passes now.
* LayoutTests/fast/css-grid-layout/subgrid-continue-collapse-expected.html: 
Added.
* LayoutTests/fast/css-grid-layout/subgrid-continue-collapse.html: Added.
* LayoutTests/fast/css-grid-layout/subgrid-continue-discard-expected.html: 
Added.
* LayoutTests/fast/css-grid-layout/subgrid-continue-discard.html: Added.
* Source/WebCore/css/parser/CSSPropertyParserCustom.h:
(WebCore::PropertyParserCustom::consumeLineClampShorthand): Set continue: 
collapse instead of discard.
* Source/WebCore/rendering/LineClampUpdater.cpp:
(WebCore::LineClampUpdater::shouldDiscardOverflow): Added. Both collapse and 
discard hide the content after the clamp point.
(WebCore::LineClampUpdater::LineClampUpdater):
(WebCore::LineClampUpdater::isAutoLineClampRoot const):
(WebCore::LineClampUpdater::setMaximumLines):
(WebCore::LineClampUpdater::setClampAfterBox):
* Source/WebCore/rendering/LineClampUpdater.h:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::establishesIndependentFormattingContextIgnoringDisplayType
 const): continue: collapse and discard
establish an independent formatting context on a block container.
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::establishesLineClampContainer const): Use 
LineClampUpdater::shouldDiscardOverflow so that

continue: collapse makes a line-clamp container too.
Canonical link: https://commits.webkit.org/323734@main



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

Reply via email to