ソースを参照

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.
Andreas Kling 3 年 前
コミット
8d5768b103

+ 2 - 2
Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp

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