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

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/rendering/LineClampUpdater.cpp
    M Source/WebCore/rendering/LineClampUpdater.h
    M Source/WebCore/rendering/RenderBlockFlow.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderElement.h
    M Source/WebCore/rendering/style/UsedStyle.h

  Log Message:
  -----------
  [line-clamp] Block boxes after the clamp point still take up space
https://bugs.webkit.org/show_bug.cgi?id=326913
<rdar://problem/189570948>

Reviewed by Antti Koivisto.

<div style="line-clamp: 2"><div>Line 1<br>Line 2<br>Line 3</div><div 
style="height: 50px"></div></div>

The box after the clamp point is invisible, but it still makes the line-clamp 
container 50px taller.
"If a block container contains a clamp point, within itself or in any of its 
descendants, its automatic block size
will not take into account any invisible boxes"
https://drafts.csswg.org/css-overflow-4/#line-clamp-containers

Now block layout does not lay out a child that is hidden by line-clamp, the 
same way inline layout discards its content
after the clamp point: it resets the child to an empty box, without adding its 
height or
margins, and clears the needs-layout bits of its content (except out-of-flow 
boxes whose containing block is outside of it).
Scrollable overflow skips it. A box that becomes visible again gets marked for 
layout.

* LayoutTests/TestExpectations: 13 tests pass now.
* Source/WebCore/rendering/LineClampUpdater.cpp:
(WebCore::isInsideInvisibleBox):
(WebCore::setIsForceHiddenByLineClamp):
(WebCore::clearNeedsLayout):
(WebCore::LineClampUpdater::skipLayoutForForcedHidden):
* Source/WebCore/rendering/LineClampUpdater.h:
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutBlockChild):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::addOverflowFromInFlowChildren):
* Source/WebCore/rendering/RenderElement.h:
(WebCore::RenderElement::isForceHiddenByLineClamp const): Renamed from 
isHiddenByLineClamp.
(WebCore::RenderElement::setIsForceHiddenByLineClamp): Renamed from 
setIsHiddenByLineClamp.
* Source/WebCore/rendering/style/UsedStyle.h:
(WebCore::UsedStyle::visibility const):

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



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

Reply via email to