Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a5773d1

Browse files
jason-simmonsGaryQian
authored andcommitted
Do not add ghost runs for trailing whitespace if the text is ellipsized (#7906)
1 parent 93eeb48 commit a5773d1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

third_party/txt/src/txt/paragraph.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,8 @@ void Paragraph::Layout(double width, bool force) {
561561
// let it impact metrics. After layout of the whitespace run, we do not
562562
// add its width into the x-offset adjustment, effectively nullifying its
563563
// impact on the layout.
564-
if (line_range.end_excluding_whitespace < line_range.end &&
564+
if (paragraph_style_.ellipsis.empty() &&
565+
line_range.end_excluding_whitespace < line_range.end &&
565566
bidi_run.start() <= line_range.end &&
566567
bidi_run.end() > line_end_index) {
567568
line_runs.emplace_back(std::max(bidi_run.start(), line_end_index),

third_party/txt/tests/paragraph_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ TEST_F(ParagraphTest, Ellipsize) {
24962496

24972497
// Check that the ellipsizer limited the text to one line and did not wrap
24982498
// to a second line.
2499-
ASSERT_EQ(paragraph->records_.size(), 2ull);
2499+
ASSERT_EQ(paragraph->records_.size(), 1ull);
25002500
}
25012501

25022502
// Test for shifting when identical runs of text are built as multiple runs.

0 commit comments

Comments
 (0)