LibWeb: Don't assume table caption box wants to create a BFC

Instead, use the generic create_independent_formatting_context_if_needed
so that unusual situations like image-as-table-caption don't crash.

This logic clearly needs more work, but let's at least do better than
crashing. This gives us 26 new subtest passes on WPT.
This commit is contained in:
Andreas Kling 2025-04-24 13:33:20 +02:00 committed by Andreas Kling
commit fbb3b06462
Notes: github-actions[bot] 2025-04-24 16:28:10 +00:00
6 changed files with 477 additions and 9 deletions

View file

@ -176,7 +176,7 @@ Optional<FormattingContext::Type> FormattingContext::formatting_context_type_cre
// FIXME: This is a hack. Get rid of it.
struct ReplacedFormattingContext : public FormattingContext {
ReplacedFormattingContext(LayoutState& state, LayoutMode layout_mode, Box const& box)
: FormattingContext(Type::Block, layout_mode, state, box)
: FormattingContext(Type::InternalReplaced, layout_mode, state, box)
{
}
virtual CSSPixels automatic_content_width() const override { return 0; }
@ -187,7 +187,7 @@ struct ReplacedFormattingContext : public FormattingContext {
// FIXME: This is a hack. Get rid of it.
struct DummyFormattingContext : public FormattingContext {
DummyFormattingContext(LayoutState& state, LayoutMode layout_mode, Box const& box)
: FormattingContext(Type::Block, layout_mode, state, box)
: FormattingContext(Type::InternalDummy, layout_mode, state, box)
{
}
virtual CSSPixels automatic_content_width() const override { return 0; }