1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-03 01:02:06 +00:00

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
parent 28b771560a
commit 8d5768b103

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;
}