From 44602ae1413dc374e7590dab738944e4e07a653d Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 30 Mar 2021 16:04:32 -0400 Subject: [PATCH] LibWeb: Create a new BFC when the overflow is neither visible nor clip From MDN, a block overflow context should be created for "Block elements where overflow has a value other than visible and clip." --- Userland/Libraries/LibWeb/Layout/FormattingContext.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 5b387bcd74..367e9c6a0f 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -60,6 +60,14 @@ bool FormattingContext::creates_block_formatting_context(const Box& box) if (is(box)) return true; + CSS::Overflow overflow_x = box.computed_values().overflow_x(); + if ((overflow_x != CSS::Overflow::Visible) && (overflow_x != CSS::Overflow::Clip)) + return true; + + CSS::Overflow overflow_y = box.computed_values().overflow_y(); + if ((overflow_y != CSS::Overflow::Visible) && (overflow_y != CSS::Overflow::Clip)) + return true; + // FIXME: inline-flex as well if (box.parent() && box.parent()->computed_values().display() == CSS::Display::Flex) { // FIXME: Flex items (direct children of the element with display: flex or inline-flex) if they are neither flex nor grid nor table containers themselves. @@ -69,7 +77,6 @@ bool FormattingContext::creates_block_formatting_context(const Box& box) // FIXME: table-caption // FIXME: anonymous table cells - // FIXME: Block elements where overflow has a value other than visible and clip. // FIXME: display: flow-root // FIXME: Elements with contain: layout, content, or paint. // FIXME: grid