LibWeb: Reinitialize TextNode chunk state after collapsing whitespace

When collapsible whitespace is skipped without committing a prior
chunk, the loop would fall through and continue with font information
derived from the last whitespace code point rather than the next
non-whitespace character. Restart the function via recursion so that
these values are reinitialized from the correct code point.
This commit is contained in:
Tim Ledbetter
2026-03-06 23:40:17 +00:00
committed by Jelle Raaijmakers
parent 815e9db05d
commit 483ea12914
Notes: github-actions[bot] 2026-03-09 14:36:13 +00:00
5 changed files with 118 additions and 1 deletions

View File

@@ -727,10 +727,11 @@ Optional<TextNode::Chunk> TextNode::ChunkIterator::next_without_peek()
while (m_current_index < m_view.length_in_code_units() && is_collapsible(current_code_point()))
m_current_index = next_grapheme_boundary();
can_break_at_current_position = is_at_line_break_opportunity();
if (result.has_value())
return result.release_value();
return next_without_peek();
}
if (m_should_wrap_lines) {