1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibWeb: Make TextNode::ChunkIterator emit an empty chunk for content:""

This ensures that we create a line box for content:"", which would
otherwise get pruned by the empty line cleanup in IFC.

The empty line box is important in this case, since it gives us a
reference point for measuring the automatic height of the IFC's
containing block. By having an empty line, we can now correctly measure
the impact of vertical margins on a generated box with content:""
and allow them to contribute to the block height.
This commit is contained in:
Andreas Kling 2022-10-14 12:38:02 +02:00
parent c70801ddbc
commit b062a0fb7c
3 changed files with 16 additions and 3 deletions

View file

@ -264,7 +264,7 @@ void InlineLevelIterator::enter_text_node(Layout::TextNode const& text_node)
.do_respect_linebreaks = do_respect_linebreaks,
.is_first_chunk = true,
.is_last_chunk = false,
.chunk_iterator = TextNode::ChunkIterator { text_node.text_for_rendering(), do_wrap_lines, do_respect_linebreaks },
.chunk_iterator = TextNode::ChunkIterator { text_node.text_for_rendering(), do_wrap_lines, do_respect_linebreaks, text_node.is_generated() && text_node.text_for_rendering().is_empty() },
};
m_text_node_context->next_chunk = m_text_node_context->chunk_iterator.next();
}