From 54013ffbe02a132f95f31042179b250c3c8c2f11 Mon Sep 17 00:00:00 2001 From: Tobias Christiansen Date: Thu, 23 Sep 2021 14:24:04 +0200 Subject: [PATCH] LibWeb: Proritize FlexFormattingContext when display: flex is specified An item with display: flex and overflow: hidden would've caused a BlockFormattingContext before. --- Userland/Libraries/LibWeb/Layout/FormattingContext.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 25fcd8b55d..a65afd4229 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -75,13 +75,14 @@ void FormattingContext::layout_inside(Box& box, LayoutMode layout_mode) return; } - if (creates_block_formatting_context(box)) { - BlockFormattingContext context(box, this); + if (box.computed_values().display() == CSS::Display::Flex) { + FlexFormattingContext context(box, this); context.run(box, layout_mode); return; } - if (box.computed_values().display() == CSS::Display::Flex) { - FlexFormattingContext context(box, this); + + if (creates_block_formatting_context(box)) { + BlockFormattingContext context(box, this); context.run(box, layout_mode); return; }