Truly independent web browser
LibWeb: Clamp sizes measuring the content of an aspect-ratio box
Andreas Klingf722d99f7d65
diff --git a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs b/Libraries/LibWeb/Rust/src/layout/sizing_context.rsindex 9370107879f..36a19b8d424 100644--- a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs@@ -2106,6 +2106,9 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {if !self.has_children(node) {return CssPixels::default();}+ // NB: Both sizes can have saturated, and every measurement below lays the content out against them.+ let other_axis_size = clamp_to_max_dimension_value(other_axis_size);+ let transferred_size = clamp_to_max_dimension_value(transferred_size);if axis == SizingAxis::Inline {return self.measure_intrinsic_inline_size(diff --git a/Tests/LibWeb/Crash/Layout/grid-item-with-aspect-ratio-and-huge-content.html b/Tests/LibWeb/Crash/Layout/grid-item-with-aspect-ratio-and-huge-content.htmlnew file mode 100644index 00000000000..afa9d770dde--- /dev/null+++ b/Tests/LibWeb/Crash/Layout/grid-item-with-aspect-ratio-and-huge-content.html@@ -0,0 +1,7 @@+<!DOCTYPE html>+<style>+ .grid { display: grid; grid-template-columns: repeat(4, 1fr); }+ .item { aspect-ratio: 354 / 419; }+ h2 { font-size: 10000000px; }+</style>+<div class="grid"><div class="item"><h2>Join the family</h2></div></div>