Do not add ghost runs for trailing whitespace if the text is ellipsized (flutter/engine#7906)

This commit is contained in:
Jason Simmons
2019-02-21 13:36:33 -08:00
committed by Gary Qian
parent 8fe68c4940
commit e1b2fdc6ba
2 changed files with 3 additions and 2 deletions

View File

@@ -561,7 +561,8 @@ void Paragraph::Layout(double width, bool force) {
// let it impact metrics. After layout of the whitespace run, we do not
// add its width into the x-offset adjustment, effectively nullifying its
// impact on the layout.
if (line_range.end_excluding_whitespace < line_range.end &&
if (paragraph_style_.ellipsis.empty() &&
line_range.end_excluding_whitespace < line_range.end &&
bidi_run.start() <= line_range.end &&
bidi_run.end() > line_end_index) {
line_runs.emplace_back(std::max(bidi_run.start(), line_end_index),

View File

@@ -2496,7 +2496,7 @@ TEST_F(ParagraphTest, Ellipsize) {
// Check that the ellipsizer limited the text to one line and did not wrap
// to a second line.
ASSERT_EQ(paragraph->records_.size(), 2ull);
ASSERT_EQ(paragraph->records_.size(), 1ull);
}
// Test for shifting when identical runs of text are built as multiple runs.