Pass _caretPrototype to prevent cache miss (#46720)
This commit is contained in:
@@ -170,6 +170,8 @@ class TextPainter {
|
||||
void markNeedsLayout() {
|
||||
_paragraph = null;
|
||||
_needsLayout = true;
|
||||
_previousCaretPosition = null;
|
||||
_previousCaretPrototype = null;
|
||||
}
|
||||
|
||||
/// The (potentially styled) text to paint.
|
||||
|
||||
@@ -365,7 +365,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
|
||||
final Offset startOffset = _textPainter.getOffsetForCaret(
|
||||
TextPosition(offset: _selection.start, affinity: _selection.affinity),
|
||||
Rect.zero,
|
||||
_caretPrototype,
|
||||
);
|
||||
// TODO(justinmc): https://github.com/flutter/flutter/issues/31495
|
||||
// Check if the selection is visible with an approximation because a
|
||||
@@ -381,7 +381,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
|
||||
final Offset endOffset = _textPainter.getOffsetForCaret(
|
||||
TextPosition(offset: _selection.end, affinity: _selection.affinity),
|
||||
Rect.zero,
|
||||
_caretPrototype,
|
||||
);
|
||||
_selectionEndInViewport.value = visibleRegion
|
||||
.inflate(visibleRegionSlop)
|
||||
|
||||
Reference in New Issue
Block a user