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 23981c41ef5..296609f29c1 100644 --- a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc @@ -477,13 +477,15 @@ void Paragraph::ComputeStrut(StrutMetrics* strut, SkFont& font) { } void Paragraph::Layout(double width, bool force) { + double rounded_width = floor(width); // Do not allow calling layout multiple times without changing anything. - if (!needs_layout_ && width == width_ && !force) { + if (!needs_layout_ && rounded_width == width_ && !force) { return; } - needs_layout_ = false; - width_ = floor(width); + width_ = rounded_width; + + needs_layout_ = false; if (!ComputeLineBreaks()) return;