LibWeb: Don't treat content: "" as collapsible whitespace

I couldn't find anything in specs about this, but it seems to be roughly
consistent with other engines.
This commit is contained in:
Andreas Kling 2022-10-14 12:30:44 +02:00
parent 4ddfc3a6db
commit c70801ddbc
Notes: sideshowbarker 2024-07-17 09:47:09 +09:00

View file

@ -152,13 +152,16 @@ Optional<InlineLevelIterator::Item> InlineLevelIterator::next(float available_wi
};
}
// NOTE: We never consider `content: ""` to be collapsible whitespace.
bool is_generated_empty_string = text_node.is_generated() && chunk.length == 0;
Item item {
.type = Item::Type::Text,
.node = &text_node,
.offset_in_node = chunk.start,
.length_in_node = chunk.length,
.width = chunk_width,
.is_collapsible_whitespace = m_text_node_context->do_collapse && chunk.is_all_whitespace,
.is_collapsible_whitespace = m_text_node_context->do_collapse && chunk.is_all_whitespace && !is_generated_empty_string,
};
add_extra_box_model_metrics_to_item(item, m_text_node_context->is_first_chunk, m_text_node_context->is_last_chunk);