LibWeb: Peek after extracting next chunk in InlineLevelIterator

Peek is used to determine if the current chunk is
the last and if so, add trailing box metrics.
For this to work correctly, it must be done only
after calling next(), otherwise peek gives us the
current chunk.
This commit is contained in:
Amish K. Naidu 2025-10-18 13:56:50 +05:30 committed by Sam Atkins
parent eeef370902
commit 884b7fcbf5
Notes: github-actions[bot] 2025-10-20 11:38:42 +00:00
6 changed files with 41 additions and 13 deletions

View file

@ -497,10 +497,11 @@ Optional<InlineLevelIterator::Item> InlineLevelIterator::next_without_lookahead(
else
m_text_node_context->is_first_chunk = false;
auto chunk_opt = m_text_node_context->chunk_iterator.next();
if (!m_text_node_context->chunk_iterator.peek(0).has_value())
m_text_node_context->is_last_chunk = true;
auto chunk_opt = m_text_node_context->chunk_iterator.next();
auto is_empty_editable = false;
if (!chunk_opt.has_value()) {
auto const is_only_chunk = m_text_node_context->is_first_chunk && m_text_node_context->is_last_chunk;