layout: Force outside ::marker to establish a BFC (#37252)

Even though we were continuing the parent BFC, we weren't updating the
SequentialLayoutState to have the correct containing block info. That
caused problem in the presence of floats.

This patch establishes an independent BFC, which avoids the problem.
This seems reasonable since outside markers are out-of-flow-ish, and it
matches Firefox. Blink implements them as inline-blocks, so they should
also establish a BFC.

Testing: Adding new tests. Some still fail because of a different issue.
Also, adding an expectation for several existing tests that were missing
it.
Fixes: #37222

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-06-06 18:01:27 +02:00 committed by GitHub
parent a1f43ab06d
commit 8540b0f6e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 768 additions and 245 deletions

View file

@ -744,9 +744,14 @@ impl BlockLevelJob<'_> {
self.propagated_data,
false, /* is_list_item */
);
// An outside ::marker must establish a BFC, and can't contain floats.
let block_formatting_context = BlockFormattingContext {
contents: block_container,
contains_floats: false,
};
ArcRefCell::new(BlockLevelBox::OutsideMarker(OutsideMarker {
base: LayoutBoxBase::new(info.into(), info.style.clone()),
block_container,
block_formatting_context,
list_item_style,
}))
},