Add saveLayer back if there's an overflowShader (#18739)

This should fix https://github.com/flutter/flutter/issues/18729

I'll add a gold test, and try to figure out how to remove the saveLayer without affecting the correctness later.
This commit is contained in:
liyuqian 2018-06-25 11:07:48 -07:00 committed by GitHub
parent e62626fd56
commit e4f08d55c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -355,7 +355,13 @@ class RenderParagraph extends RenderBox {
if (_hasVisualOverflow) {
final Rect bounds = offset & size;
if (_overflowShader != null) {
// This layer limits what the shader below blends with to be just the text
// (as opposed to the text and its background).
canvas.saveLayer(bounds, new Paint());
} else {
canvas.save();
}
canvas.clipRect(bounds);
}
_textPainter.paint(canvas, offset);