Do not add ghost runs for trailing whitespace if the text is ellipsized (flutter/engine#7906)
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user