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
8 changes: 5 additions & 3 deletions lib/web_ui/lib/src/engine/text/canvas_paragraph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,13 @@ void _applySpanStylesToParagraph({
}

void _positionSpanElement(html.Element element, EngineLineMetrics line, RangeBox box) {
final ui.TextBox textBox = box.toTextBox(line);
final ui.Rect boxRect = box.toTextBox(line, forPainting: true).toRect();
element.style
..position = 'absolute'
..top = '${textBox.top}px'
..left = '${textBox.left}px';
..top = '${boxRect.top}px'
..left = '${boxRect.left}px'
// This is needed for space-only spans that are used to justify the paragraph.
..width = '${boxRect.width}px';
}

/// A common interface for all types of spans that make up a paragraph.
Expand Down
Loading