LibWeb: Don't treat inline-level children of flex items as whitespace

This was causing us to collapse some children of flex items as if they
were useless whitespace text nodes.
This commit is contained in:
Andreas Kling 2022-03-18 22:39:48 +01:00
commit 8d5768b103
Notes: sideshowbarker 2024-07-17 17:07:56 +09:00

View file

@ -154,8 +154,8 @@ void FlexFormattingContext::generate_anonymous_flex_items()
// Skip anonymous text runs that are only whitespace.
if (child_box.is_anonymous() && !child_box.first_child_of_type<BlockContainer>()) {
bool contains_only_white_space = true;
child_box.for_each_in_inclusive_subtree_of_type<TextNode>([&contains_only_white_space](auto& text_node) {
if (!text_node.dom_node().data().is_whitespace()) {
child_box.for_each_in_subtree([&](auto const& node) {
if (!is<TextNode>(node) || !static_cast<TextNode const&>(node).dom_node().data().is_whitespace()) {
contains_only_white_space = false;
return IterationDecision::Break;
}