Cache caret parameters (#38821)

This commit is contained in:
Gary Qian 2019-08-20 10:21:30 -07:00 committed by GitHub
parent b7abf56a0b
commit 9da68fcdaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -782,6 +782,10 @@ class TextPainter {
offset: rect != null ? Offset(rect.left, rect.top) : _emptyOffset,
fullHeight: rect != null ? rect.bottom - rect.top : null,
);
// Cache the input parameters to prevent repeat work later.
_previousCaretPosition = position;
_previousCaretPrototype = caretPrototype;
}
/// Returns a list of rects that bound the given selection.