summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorAliaksandr Kalenik <kalenik.aliaksandr@gmail.com>2022-12-11 01:27:42 +0300
committerAndreas Kling <kling@serenityos.org>2022-12-11 22:08:44 +0100
commitdaece542f5eada0653bb8a81ac37e6b4a35df364 (patch)
tree5b9153fa93039db7ea9bc540a8ea64a301f9ad7e /Userland/Libraries/LibWeb
parent108a8e4c886be9a0a9e1aa53dce8db838b01f4a4 (diff)
downloadserenity-daece542f5eada0653bb8a81ac37e6b4a35df364.zip
LibWeb: Check if block creates BFC even if all it's children are inline
Even if block has all children inline there need to be a check if it creates BFC because otherwise IFC will be looking in wrong parent BFC to calculate space used by floats.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp9
-rw-r--r--Userland/Libraries/LibWeb/Layout/FormattingContext.cpp3
2 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
index d1de0c83a2..c18bbf13ac 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
@@ -377,12 +377,11 @@ void BlockFormattingContext::layout_block_level_box(Box const& box, BlockContain
OwnPtr<FormattingContext> independent_formatting_context;
if (!box.is_replaced_box() && box.has_children()) {
- if (box.children_are_inline()) {
- layout_inline_children(verify_cast<BlockContainer>(box), layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
+ if (auto independent_formatting_context = create_independent_formatting_context_if_needed(m_state, box)) {
+ independent_formatting_context->run(box, layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
} else {
- independent_formatting_context = create_independent_formatting_context_if_needed(m_state, box);
- if (independent_formatting_context)
- independent_formatting_context->run(box, layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
+ if (box.children_are_inline())
+ layout_inline_children(verify_cast<BlockContainer>(box), layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
else
layout_block_level_children(verify_cast<BlockContainer>(box), layout_mode, box_state.available_inner_space_or_constraints_from(available_space));
}
diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
index edf2f8d1b1..a85121caf1 100644
--- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
@@ -155,7 +155,8 @@ OwnPtr<FormattingContext> FormattingContext::create_independent_formatting_conte
}
VERIFY(is_block_formatting_context());
- VERIFY(!child_box.children_are_inline());
+ if (child_box.children_are_inline())
+ return {};
// The child box is a block container that doesn't create its own BFC.
// It will be formatted by this BFC.