Skip to content

Commit

Permalink
https://bugs.webkit.org/show_bug.cgi?id=273660
Browse files Browse the repository at this point in the history
<rdar://127270565>

Reviewed by Antti Koivisto.

RenderDeprecatedFlexibleBox marks direct children dirty when dealing with line-clamp, but
since this functionality gets propagated to nested block containers too, we need to make sure
descendant content gets laid out (in order to be able to figure out where to clamp inline content).

* LayoutTests/fast/inline/dynamic-line-clamp-change-on-nested-content-expected.html: Added.
* LayoutTests/fast/inline/dynamic-line-clamp-change-on-nested-content.html: Added.
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutBlock):

Canonical link: https://commits.webkit.org/278384@main
  • Loading branch information
alanbaradlay committed May 5, 2024
1 parent 9e40c12 commit f941ea9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PASS
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<style>
#container {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 2;
}
</style>
<div id=container><div>PASS<div>if this is not<div>visible</div></div>
<script>
document.body.offsetHeight;
container.style.webkitLineClamp = "1";
</script>
3 changes: 3 additions & 0 deletions Source/WebCore/rendering/RenderBlockFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ void RenderBlockFlow::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalH
if (recomputeLogicalWidthAndColumnWidth())
relayoutChildren = true;

if (auto* layoutState = view().frameView().layoutContext().layoutState(); layoutState && layoutState->lineClamp())
relayoutChildren = true;

rebuildFloatingObjectSetFromIntrudingFloats();

LayoutUnit previousHeight = logicalHeight();
Expand Down

0 comments on commit f941ea9

Please sign in to comment.