From 3506a913493a54898700cb3f759d2b54a92ab70c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 27 Feb 2022 09:47:01 +0100 Subject: [PATCH] LibWeb: Avoid unnecessary layout_inside() in FFC step 1 We don't need to perform inside layout here. The only information we need in this step is whether an anonymous block container has nothing but empty-or-whitespace text children. This information is already accurate after the initial layout tree construction. Performing a layout does not change the answer. It does however have many other side effects, so let's defer those. --- Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index 4f77355e14..3f8838bbc4 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -171,12 +171,11 @@ void FlexFormattingContext::generate_anonymous_flex_items() } flex_container().for_each_child_of_type([&](Box& child_box) { - (void)layout_inside(child_box, LayoutMode::Default); // Skip anonymous text runs that are only whitespace. if (child_box.is_anonymous() && !child_box.first_child_of_type()) { bool contains_only_white_space = true; child_box.for_each_in_inclusive_subtree_of_type([&contains_only_white_space](auto& text_node) { - if (!text_node.text_for_rendering().is_whitespace()) { + if (!text_node.dom_node().data().is_whitespace()) { contains_only_white_space = false; return IterationDecision::Break; }