diff options
author | Tom <martinmotteditfalisse@gmail.com> | 2022-12-28 10:11:54 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-28 15:04:58 +0100 |
commit | 0bbf7a1b541c01a39f493206000c77b9474e2ceb (patch) | |
tree | 53e6a1a41f08604f23e00fdb24338f3a43dc2059 /Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | |
parent | 97dde51a9b3f253b7cce2f31592ecac6a170c503 (diff) | |
download | serenity-0bbf7a1b541c01a39f493206000c77b9474e2ceb.zip |
LibWeb: Refactor should_skip_anonymous_text_runs
This same function was being copied in the {Flex,Grid}FormattingContext,
so unify them in the parent FormattingContext.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index 86c212fc10..c730e67b69 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -305,19 +305,8 @@ void FlexFormattingContext::generate_anonymous_flex_items() HashMap<int, Vector<FlexItem>> order_item_bucket; flex_container().for_each_child_of_type<Box>([&](Box& child_box) { - // Skip anonymous text runs that are only whitespace. - if (child_box.is_anonymous() && !child_box.is_generated() && !child_box.first_child_of_type<BlockContainer>()) { - bool contains_only_white_space = true; - 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; - } - return IterationDecision::Continue; - }); - if (contains_only_white_space) - return IterationDecision::Continue; - } + if (can_skip_is_anonymous_text_run(child_box)) + return IterationDecision::Continue; // Skip any "out-of-flow" children if (child_box.is_out_of_flow(*this)) |