Skip to content
Permalink
Browse files
[line-clamp][IFC] Line with 0px constrain should still be considered …
…as a non-empty line if it has content

https://bugs.webkit.org/show_bug.cgi?id=248882

Reviewed by Antti Koivisto.

Just because lineLogicalRect is empty (width: 0px;) it does not necessarily mean it has no (overflowing) content.

* LayoutTests/fast/block/zero-width-block-with-line-clamp-multiple-lines-expected.html: Added.
* LayoutTests/fast/block/zero-width-block-with-line-clamp-multiple-lines.html: Added.
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):

Canonical link: https://commits.webkit.org/257528@main
  • Loading branch information
alanbaradlay committed Dec 8, 2022
1 parent fc8aae2 commit 2302481aabb3978e5cdaf79ff5b169c814ad3e92
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
@@ -0,0 +1,9 @@
<style>
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
width: 30px;
}
</style>
<div class=ellipsis>PASS</div>
<div style="width: 0px">if only the first line has ellipsis</div>
@@ -0,0 +1,9 @@
<style>
div {
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
width: 0px;
}
</style>
<div>PASS if only the first line has ellipsis</div>
@@ -266,7 +266,7 @@ void InlineFormattingContext::lineLayout(InlineItems& inlineItems, const LineBui
break;
}

if (!lineContent.runs.isEmpty() && !lineLogicalRect.isEmpty())
if (!lineContent.runs.isEmpty() && lineContent.contentLogicalWidth)
++numberOfLines;
lineLogicalTop = formattingGeometry().logicalTopForNextLine(lineContent, lineLogicalRect, floatingContext);
previousLine = LineBuilder::PreviousLine { !lineContent.runs.isEmpty() && lineContent.runs.last().isLineBreak(), lineContent.inlineBaseDirection, lineContent.partialOverflowingContent, WTFMove(lineContent.overflowingFloats), lineContent.trailingOverflowingContentWidth };

0 comments on commit 2302481

Please sign in to comment.