From e1b2fdc6bac91fd6d95799c52354898d7cd951ab Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 21 Feb 2019 13:36:33 -0800 Subject: [PATCH] Do not add ghost runs for trailing whitespace if the text is ellipsized (flutter/engine#7906) --- engine/src/flutter/third_party/txt/src/txt/paragraph.cc | 3 ++- .../src/flutter/third_party/txt/tests/paragraph_unittests.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc index e8a83b96d2..7c1ab261eb 100644 --- a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc @@ -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), diff --git a/engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc b/engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc index 622bca0b0f..52781a70f7 100644 --- a/engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc +++ b/engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc @@ -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.