LibWeb: Layout all math elements using InternalDummy context

Always create a new formatting context for <math> elements. Previously
that didn't happen if they only had inline children, e.g. mtable.

This fixes a crash in the WPT MathML test
mathml/crashtests/children-with-negative-block-sizes.html
This commit is contained in:
David Smith 2024-10-15 18:53:19 +02:00 committed by Alexander Kalenik
parent 4408ea7c9b
commit e7c209820d
Notes: github-actions[bot] 2024-10-16 17:52:28 +00:00
3 changed files with 16 additions and 0 deletions

View file

@ -0,0 +1 @@
PASS (didn't crash)

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<math>
<mtable></mtable>
</math>
<script src="include.js"></script>
<script>
test(() => {
println("PASS (didn't crash)");
});
</script>

View file

@ -136,6 +136,10 @@ Optional<FormattingContext::Type> FormattingContext::formatting_context_type_cre
if (display.is_grid_inside()) if (display.is_grid_inside())
return Type::Grid; return Type::Grid;
if (display.is_math_inside())
// HACK: Instead of crashing, create a dummy formatting context that does nothing.
return Type::InternalDummy;
if (creates_block_formatting_context(box)) if (creates_block_formatting_context(box))
return Type::Block; return Type::Block;