mirror of
https://github.com/RGBCube/serenity
synced 2025-07-08 22:47:34 +00:00
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.
This commit is contained in:
parent
6d2c298b66
commit
3506a91349
1 changed files with 1 additions and 2 deletions
|
@ -171,12 +171,11 @@ void FlexFormattingContext::generate_anonymous_flex_items()
|
||||||
}
|
}
|
||||||
|
|
||||||
flex_container().for_each_child_of_type<Box>([&](Box& child_box) {
|
flex_container().for_each_child_of_type<Box>([&](Box& child_box) {
|
||||||
(void)layout_inside(child_box, LayoutMode::Default);
|
|
||||||
// Skip anonymous text runs that are only whitespace.
|
// Skip anonymous text runs that are only whitespace.
|
||||||
if (child_box.is_anonymous() && !child_box.first_child_of_type<BlockContainer>()) {
|
if (child_box.is_anonymous() && !child_box.first_child_of_type<BlockContainer>()) {
|
||||||
bool contains_only_white_space = true;
|
bool contains_only_white_space = true;
|
||||||
child_box.for_each_in_inclusive_subtree_of_type<TextNode>([&contains_only_white_space](auto& text_node) {
|
child_box.for_each_in_inclusive_subtree_of_type<TextNode>([&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;
|
contains_only_white_space = false;
|
||||||
return IterationDecision::Break;
|
return IterationDecision::Break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue