[webkit-changes] [WebKit/WebKit] 497986: [legacy line-clamp] line clamping results in ellip...
Alan Baradlay
noreply at github.com
Thu Oct 3 20:32:25 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 497986a13096abbf81255971409f4434844133a7
https://github.com/WebKit/WebKit/commit/497986a13096abbf81255971409f4434844133a7
Author: Alan Baradlay <zalan at apple.com>
Date: 2024-10-03 (Thu, 03 Oct 2024)
Changed paths:
A LayoutTests/fast/inline/line-clamp-with-trailing-empty-line-expected.html
A LayoutTests/fast/inline/line-clamp-with-trailing-empty-line.html
M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
M Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp
M Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.h
M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
Log Message:
-----------
[legacy line-clamp] line clamping results in ellipsis even when ample space
https://bugs.webkit.org/show_bug.cgi?id=280839
<rdar://136168237>
Reviewed by Antti Koivisto.
1. Simplify isLastLineWithInlineContent logic and just start at the current line end and loop until we find a contentful inline item. (e.g. <div>some text<br><span></span> <- first line is last line with inline content).
2. Make sure that we don't try to put ellipsis on a completely empty line which could be the line _after_ the last line with inline content.
(e.g. see the attached test case with the trailing (but trimmed) whitespace)
* LayoutTests/fast/inline/line-clamp-with-trailing-empty-line-expected.html: Added.
* LayoutTests/fast/inline/line-clamp-with-trailing-empty-line.html: Added.
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::createDisplayContentForInlineContent):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp:
(WebCore::Layout::InlineFormattingUtils::horizontalAlignmentOffset):
(WebCore::Layout::InlineFormattingUtils::textEmphasisForInlineBox):
(WebCore::Layout::InlineFormattingUtils::lineEndingTruncationPolicy):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::isContentfulOrHasDecoration):
(WebCore::Layout::LineBuilder::isLastLineWithInlineContent const):
Canonical link: https://commits.webkit.org/284658@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list