Min/Max size transfers should work only when inline size is not specified.

We have to apply min/max transferred size if inline size is auto or intrinsic
size keywords.

The basic principle is that sizing constraints transfer through the
aspect-ratio to the other side to preserve the aspect ratio to the extent
that they can without violating any sizes specified explicitly on that
affected axis.

Note: block-aspect-ratio-021.html tests the similar case with the non-zero
content size. However we don't have the similar tests for intrinsic size
keywords, so I add them in this patch as well.

Differential Revision: https://phabricator.services.mozilla.com/D110725

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1702835
gecko-commit: 379285a42f124620d09d77524db5465e1591e001
gecko-reviewers: TYLin, emilio
diff --git a/css/css-sizing/aspect-ratio/block-aspect-ratio-032.html b/css/css-sizing/aspect-ratio/block-aspect-ratio-032.html
new file mode 100644
index 0000000..cb8dfdf
--- /dev/null
+++ b/css/css-sizing/aspect-ratio/block-aspect-ratio-032.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<title>CSS aspect-ratio: div inline size with height and {min|max}-height</title>
+<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
+<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio-size-transfers">
+<link rel="match" href="../../reference/ref-filled-green-100px-square.xht" />
+<meta name="assert" content="A {min|max}-height constraint should be transferred through the aspect-ratio to apply to the inline size">
+
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+
+<div style="background: green; aspect-ratio: 4/1; height: 300px; max-height: 25px;"></div>
+<div style="background: green; aspect-ratio: 4/1; height: 10px; min-height: 25px;"></div>
+
+<div style="background: green; aspect-ratio: 4/1; width: min-content; height: 300px; max-height: 25px;"></div>
+<div style="background: green; aspect-ratio: 4/1; width: min-content; height: 10px; min-height: 25px;"></div>
diff --git a/css/css-sizing/aspect-ratio/block-aspect-ratio-033.html b/css/css-sizing/aspect-ratio/block-aspect-ratio-033.html
new file mode 100644
index 0000000..ed9714b
--- /dev/null
+++ b/css/css-sizing/aspect-ratio/block-aspect-ratio-033.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<title>CSS aspect-ratio: div block size with width and {min|max}-width</title>
+<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
+<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio-size-transfers">
+<link rel="match" href="../../reference/ref-filled-green-100px-square.xht" />
+<meta name="assert" content="A {min|max}-width constraint should be transferred through the aspect-ratio to apply to the block size">
+
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+
+<div style="background: green; aspect-ratio: 2/1; width: 300px; max-width: 100px;"></div>
+<div style="background: green; aspect-ratio: 2/1; width: 10px; min-width: 100px;"></div>