Skip to content

HTML renderer paragraph reports an empty line when the text is empty #143331

@LongCatIsLooong

Description

@LongCatIsLooong

Repro steps:

  test('empty paragraph is empty', () {
    final TextPainter painter = TextPainter(
      textDirection: TextDirection.ltr,
      text: const TextSpan(),
    )..layout();

    expect(painter.computeLineMetrics(), isEmpty);
  });

Run flutter test test/painting/text_painter_test.dart --platform=chrome --web-renderer=html --plain-name='empty paragraph is empty'

it fails with error message:

Expected: empty
Actual: [
  EngineLineMetrics:LineMetrics(hardBreak: true, ascent: 10, descent: 4, unscaledAscent: 10, height: 14, width: 0, left: 0, baseline: 10, lineNumber: 0)
]

The behavior is reasonable but it's inconsistent with what SkParagraph reports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: text inputEntering text in a text field or keyboard related problemse: web_htmlHTML rendering backend for Webengineflutter/engine related. See also e: labels.found in release: 3.20Found to occur in 3.20has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: solvedIssue is closed as solvedteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions