.container) [8,8 150x150]
+ ImagePaintable (ImageBox
.replaced) [8,8 150x150]
diff --git a/Tests/LibWeb/Layout/input/replaced-within-max-content.html b/Tests/LibWeb/Layout/input/replaced-within-max-content.html
new file mode 100644
index 00000000000..80536c32dde
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/replaced-within-max-content.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
index 6fcb9a1474a..168c0bf4b49 100644
--- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
@@ -274,7 +274,7 @@ CSSPixelSize FormattingContext::solve_replaced_size_constraint(CSSPixels input_w
auto specified_max_height = should_treat_max_height_as_none(box, available_space.height) ? input_height : box.computed_values().max_height().to_px(box, height_of_containing_block);
auto max_height = max(min_height, specified_max_height);
- auto aspect_ratio = input_width / input_height;
+ CSSPixelFraction aspect_ratio = *box.preferred_aspect_ratio();
// These are from the "Constraint Violation" table in spec, but reordered so that each condition is
// interpreted as mutually exclusive to any other.