Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/web_ui/lib/src/engine/text/layout_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ class TextLayoutService {
didExceedMaxLines = false;
lines.clear();

if (spanCount == 0) {
return;
}

final Spanometer spanometer = Spanometer(paragraph, context);

int spanIndex = 0;
Expand Down
10 changes: 10 additions & 0 deletions lib/web_ui/test/text/layout_service_plain_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ void main() {
void testMain() async {
await ui.webOnlyInitializeTestDomRenderer();

test('no text', () {
final CanvasParagraph paragraph = CanvasParagraphBuilder(ahemStyle).build();
paragraph.layout(constrain(double.infinity));

expect(paragraph.maxIntrinsicWidth, 0);
expect(paragraph.minIntrinsicWidth, 0);
expect(paragraph.height, 0);
expect(paragraph.computeLineMetrics(), isEmpty);
});

test('preserves whitespace when measuring', () {
CanvasParagraph paragraph;

Expand Down