Request a layout when a paragraph's overflow mode is changed (#9485)

A change in overflow mode requires calculation of the text size and resetting
the overflow shader
This commit is contained in:
Jason Simmons 2017-04-19 17:06:58 -07:00 committed by GitHub
parent a657428b5c
commit da7867be0e
2 changed files with 5 additions and 1 deletions

View File

@ -98,7 +98,7 @@ class RenderParagraph extends RenderBox {
return; return;
_overflow = value; _overflow = value;
_textPainter.ellipsis = value == TextOverflow.ellipsis ? _kEllipsis : null; _textPainter.ellipsis = value == TextOverflow.ellipsis ? _kEllipsis : null;
markNeedsPaint(); markNeedsLayout();
} }
/// The number of font pixels for each logical pixel. /// The number of font pixels for each logical pixel.

View File

@ -140,6 +140,10 @@ void main() {
relayoutWith(maxLines: 3, softWrap: true, overflow: TextOverflow.fade); relayoutWith(maxLines: 3, softWrap: true, overflow: TextOverflow.fade);
expect(paragraph.debugHasOverflowShader, isTrue); expect(paragraph.debugHasOverflowShader, isTrue);
// Change back to ellipsis and check that the fade shader is cleared.
relayoutWith(maxLines: 3, softWrap: true, overflow: TextOverflow.ellipsis);
expect(paragraph.debugHasOverflowShader, isFalse);
relayoutWith(maxLines: 100, softWrap: true, overflow: TextOverflow.fade); relayoutWith(maxLines: 100, softWrap: true, overflow: TextOverflow.fade);
expect(paragraph.debugHasOverflowShader, isFalse); expect(paragraph.debugHasOverflowShader, isFalse);
}); });