Unverified Commit ab3602b7 authored by Tomasz Gucio's avatar Tomasz Gucio Committed by GitHub

Use paragraph getter in TextPainter (#127607)

parent 224667e9
......@@ -369,6 +369,7 @@ class _TextPainterLayoutCacheWithOffset {
TextWidthBasis.parent => clampDouble(layout.maxIntrinsicLineExtent, minWidth, maxWidth),
};
}
// Try to resize the contentWidth to fit the new input constraints, by just
// adjusting the paint offset (so no line-breaking changes needed).
//
......@@ -398,8 +399,8 @@ class _TextPainterLayoutCacheWithOffset {
assert(paragraph.width == double.infinity);
return false;
}
final double maxIntrinsicWidth = layout._paragraph.maxIntrinsicWidth;
if ((layout._paragraph.width - maxIntrinsicWidth) > -precisionErrorTolerance && (maxWidth - maxIntrinsicWidth) > -precisionErrorTolerance) {
final double maxIntrinsicWidth = paragraph.maxIntrinsicWidth;
if ((paragraph.width - maxIntrinsicWidth) > -precisionErrorTolerance && (maxWidth - maxIntrinsicWidth) > -precisionErrorTolerance) {
// Adjust the paintOffset and contentWidth to the new input constraints.
contentWidth = newContentWidth;
return true;
......@@ -889,7 +890,7 @@ class TextPainter {
if (span is PlaceholderSpan) {
placeholderCount += 1;
}
return value.length >= placeholderCount ;
return value.length >= placeholderCount;
});
return placeholderCount == value.length;
}());
......@@ -1129,7 +1130,7 @@ class TextPainter {
return true;
}());
final ui.Paragraph paragraph = layoutCache.layout._paragraph;
final ui.Paragraph paragraph = layoutCache.paragraph;
// Unfortunately even if we know that there is only paint changes, there's
// no API to only make those updates so the paragraph has to be recreated
// and re-laid out.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment