Skip to content

Commit 9c54077

Browse files
committed
Revert "Reland "Clipping if only one character text overflows (flutter#99146)" (flutter#102130)"
This reverts commit 3f43d9f.
1 parent 75a649f commit 9c54077

File tree

3 files changed

+1
-34
lines changed

3 files changed

+1
-34
lines changed

packages/flutter/lib/src/painting/text_painter.dart

-9
Original file line numberDiff line numberDiff line change
@@ -599,15 +599,6 @@ class TextPainter {
599599
return _paragraph!.didExceedMaxLines;
600600
}
601601

602-
/// The distance from the left edge of the leftmost glyph to the right edge of
603-
/// the rightmost glyph in the paragraph.
604-
///
605-
/// Valid only after [layout] has been called.
606-
double get longestLine {
607-
assert(!_debugNeedsLayout);
608-
return _paragraph!.longestLine;
609-
}
610-
611602
double? _lastMinWidth;
612603
double? _lastMaxWidth;
613604

packages/flutter/lib/src/rendering/paragraph.dart

+1-7
Original file line numberDiff line numberDiff line change
@@ -630,12 +630,6 @@ class RenderParagraph extends RenderBox
630630
@visibleForTesting
631631
bool get debugHasOverflowShader => _overflowShader != null;
632632

633-
/// Whether this paragraph currently has overflow and needs clipping.
634-
///
635-
/// Used to test this object. Not for use in production.
636-
@visibleForTesting
637-
bool get debugNeedsClipping => _needsClipping;
638-
639633
void _layoutText({ double minWidth = 0.0, double maxWidth = double.infinity }) {
640634
final bool widthMatters = softWrap || overflow == TextOverflow.ellipsis;
641635
_textPainter.layout(
@@ -787,7 +781,7 @@ class RenderParagraph extends RenderBox
787781
size = constraints.constrain(textSize);
788782

789783
final bool didOverflowHeight = size.height < textSize.height || textDidExceedMaxLines;
790-
final bool didOverflowWidth = size.width < textSize.width || size.width < _textPainter.longestLine;
784+
final bool didOverflowWidth = size.width < textSize.width;
791785
// TODO(abarth): We're only measuring the sizes of the line boxes here. If
792786
// the glyphs draw outside the line boxes, we might think that there isn't
793787
// visual overflow when there actually is visual overflow. This can become

packages/flutter/test/rendering/paragraph_test.dart

-18
Original file line numberDiff line numberDiff line change
@@ -326,24 +326,6 @@ void main() {
326326
expect(paragraph.debugHasOverflowShader, isFalse);
327327
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61018
328328

329-
test('one character clip test', () {
330-
// Regressing test for https://github.com/flutter/flutter/issues/99140
331-
final RenderParagraph paragraph = RenderParagraph(
332-
const TextSpan(
333-
text: '7',
334-
style: TextStyle(fontFamily: 'Ahem', fontSize: 60.0),
335-
),
336-
textDirection: TextDirection.ltr,
337-
maxLines: 1,
338-
);
339-
340-
// Lay out in a narrow box to force clipping.
341-
// The text width is 60 bigger than the constraints width.
342-
layout(paragraph, constraints: BoxConstraints.tight(const Size(50.0, 200.0)));
343-
344-
expect(paragraph.debugNeedsClipping, true);
345-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61018
346-
347329
test('maxLines', () {
348330
final RenderParagraph paragraph = RenderParagraph(
349331
const TextSpan(

0 commit comments

Comments
 (0)