Make preferred isize of SVG with no preferred aspect-ratio fall back to fallback intrinsic size.

To match blink and webkit's behavior.

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1801581
gecko-commit: cb640b83609b8a95649df0813299f162e6688ccc
gecko-reviewers: firefox-svg-reviewers, emilio, dholbert
diff --git a/css/css-sizing/svg-intrinsic-size-006-ref.html b/css/css-sizing/svg-intrinsic-size-006-ref.html
new file mode 100644
index 0000000..4e16467
--- /dev/null
+++ b/css/css-sizing/svg-intrinsic-size-006-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Test Reference: Test SVG intrinsic sizing with and without preferred aspect-ratio</title>
+<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1801581">
+
+<style>
+div {
+  width: 300px;
+  height: 30px;
+  background: green;
+  line-height: 0;
+  border: 5px solid black;
+  margin: 5px;
+}
+</style>
+
+<!-- Chrome 110 and Safari 16.4 render these two divs with zero width. -->
+<div style="width: 0; height: 0"></div>
+<div style="width: 0; height: 0"></div>
+
+<!-- Chrome 110 and Safari 16.4 render the following divs with 300px width. -->
+<div style="width: 300px; height: 150px"></div>
+<div></div>
+<div></div>
+<div></div>
+<div></div>
diff --git a/css/css-sizing/svg-intrinsic-size-006.html b/css/css-sizing/svg-intrinsic-size-006.html
new file mode 100644
index 0000000..b136c01
--- /dev/null
+++ b/css/css-sizing/svg-intrinsic-size-006.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Test: Test SVG intrinsic sizing with and without preferred aspect-ratio</title>
+<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1801581">
+<link rel="match" href="svg-intrinsic-size-006-ref.html">
+
+<style>
+div {
+  width: max-content;
+  background: green;
+  line-height: 0;
+  border: 5px solid black;
+  margin: 5px;
+}
+svg {
+  vertical-align: top;
+}
+</style>
+
+<!-- Chrome 110 and Safari 16.4 render these two divs with zero width. -->
+<div><svg viewBox="0 0 1 1"></svg></div>
+<div><svg style="aspect-ratio: 1/1;"></svg></div>
+
+<!-- Chrome 110 and Safari 16.4 render the following divs with 300px width. -->
+<div><svg></svg></div>
+<div><svg style="width: 10%" viewBox="0 0 1 1"></svg></div>
+<div><svg width="10%" viewBox="0 0 1 1"></svg></div>
+<div><svg style="width: 10%; aspect-ratio: 1/1"></svg></div>
+<div><svg width="10%" style="aspect-ratio: 1/1"></svg></div>