LibWeb: Stop collecting lookahead items on forced break

This avoids a crash since such items don't have a node nor CSS
properties. Fixes crashes on Wikipedia pages which contain preformatted
code.
This commit is contained in:
Andi Gallo 2023-08-22 06:38:17 +00:00 committed by Andreas Kling
commit 685ef4ec82
Notes: sideshowbarker 2024-07-17 03:59:29 +09:00
3 changed files with 22 additions and 0 deletions

View file

@ -140,6 +140,8 @@ CSSPixels InlineLevelIterator::next_non_whitespace_sequence_width()
break;
m_lookahead_items.enqueue(next_item_opt.release_value());
auto& next_item = m_lookahead_items.tail();
if (next_item.type == InlineLevelIterator::Item::Type::ForcedBreak)
break;
if (next_item.node->computed_values().white_space() != CSS::WhiteSpace::Nowrap) {
if (next_item.type != InlineLevelIterator::Item::Type::Text)
break;