From 5ff1fc4347ca953607b5882d14b802c5d10505fa Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 6 Oct 2022 17:29:05 +0200 Subject: [PATCH] LibWeb: Make sure replaced elements never create a BFC --- Userland/Libraries/LibWeb/Layout/FormattingContext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 6d7c3c5f3b..3404897537 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -33,6 +33,10 @@ FormattingContext::~FormattingContext() = default; // https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context bool FormattingContext::creates_block_formatting_context(Box const& box) { + // NOTE: Replaced elements never create a BFC. + if (box.is_replaced_box()) + return false; + // NOTE: This function uses MDN as a reference, not because it's authoritative, // but because they've gathered all the conditions in one convenient location.