LibWeb: Set is_first_chunk to false as needed in InlineLevelIterator

`m_text_node_context->is_first_chunk` was always true because
`InlineLevelIterator::next_without_lookahead` never set it to false.
This commit is contained in:
zac 2025-08-08 21:09:42 +10:00 committed by Sam Atkins
commit fca2d71b16
Notes: github-actions[bot] 2025-09-24 11:34:41 +00:00
3 changed files with 47 additions and 0 deletions

View file

@ -493,6 +493,8 @@ Optional<InlineLevelIterator::Item> InlineLevelIterator::next_without_lookahead(
if (auto* text_node = as_if<Layout::TextNode>(*m_current_node)) { if (auto* text_node = as_if<Layout::TextNode>(*m_current_node)) {
if (!m_text_node_context.has_value()) if (!m_text_node_context.has_value())
enter_text_node(*text_node); enter_text_node(*text_node);
else
m_text_node_context->is_first_chunk = false;
auto chunk_opt = m_text_node_context->chunk_iterator.next(); auto chunk_opt = m_text_node_context->chunk_iterator.next();
if (!chunk_opt.has_value()) { if (!chunk_opt.has_value()) {

View file

@ -0,0 +1,33 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 71 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,13] [8+0+0 784 0+0+8] [8+0+0 45 0+0+13] children: not-inline
BlockContainer <div> at [8,13] [0+0+0 784 0+0+0] [0+0+0 45 0+0+0] children: not-inline
BlockContainer <(anonymous)> at [8,13] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
BlockContainer <pre> at [8,13] [0+0+0 784 0+0+0] [13+0+0 45 0+0+13] children: inline
frag 0 from TextNode start: 0, length: 5, rect: [8,13 29.921875x15] baseline: 11.390625
"hello"
frag 1 from TextNode start: 1, length: 1, rect: [8,43 6.5x15] baseline: 11.390625
" "
TextNode <#text> (not painted)
InlineNode <code> at [8,13] [0+10+0 0 0+10+0] [0+10+0 15 0+10+0]
TextNode <#text> (not painted)
BlockContainer <(anonymous)> at [8,71] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
BlockContainer <(anonymous)> at [8,71] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
TextNode <#text> (not painted)
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x71]
PaintableWithLines (BlockContainer<BODY>) [8,13 784x45]
PaintableWithLines (BlockContainer<DIV>) [8,13 784x45]
PaintableWithLines (BlockContainer(anonymous)) [8,13 784x0]
PaintableWithLines (BlockContainer<PRE>) [8,13 784x45]
TextPaintable (TextNode<#text>)
PaintableWithLines (InlineNode<CODE>) [-2,3 20x35]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer(anonymous)) [8,71 784x0]
PaintableWithLines (BlockContainer(anonymous)) [8,71 784x0]
SC for Viewport<#document> [0,0 800x600] [children: 1] (z-index: auto)
SC for BlockContainer<HTML> [0,0 800x71] [children: 0] (z-index: auto)

View file

@ -0,0 +1,12 @@
<!doctype html>
<style>
code{
border: solid 10px black;
}
</style>
<div>
<pre>
hello
<code></code>
</pre>
</div>