SIGN IN SIGN UP

[line-clamp] A line-clamp container does not establish an independent formatting context

https://bugs.webkit.org/show_bug.cgi?id=326200
<rdar://problem/189090409>

Reviewed by Antti Koivisto.

<div style="line-clamp: auto; max-height: 160px; line-height: 32px"><div style="margin: 16px">Line 1<br>Line 2<br>Line 3<br>Line 4<br>Line 5</div></div>

The inner div's margins should stay inside the line-clamp container, so only 4 lines fit. The container does
not establish an independent formatting context, so the margins collapse through it and 5 lines fit instead.
Per spec, a box with continue: discard (which is what line-clamp sets in WebKit) "must establish an independent
formatting context".
(https://drafts.csswg.org/css-overflow-4/#valdef-continue-discard)

* LayoutTests/TestExpectations: line-clamp-auto-028, -029, -030 and line-clamp-bfc pass now.
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::establishesIndependentFormattingContextIgnoringDisplayType const):

Canonical link: https://commits.webkit.org/322767@main
A
Alan Baradlay committed
3fc0c58adaefe62b3b1b538320da79a47072997c
Parent: 08cf53b