Intrinsic sizes that depend on percentage-sized abspos ancestors should account for containing-block padding correctly.

Abspos boxes resolve against the pading box, and we were failing to
increase the percentage basis in that case if box-sizing was
content-box.

This is partially the cause of bug 1691374.

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1691397
gecko-commit: 83d93b876225b37ec0a8afd837eeb939fc0e4ae3
gecko-reviewers: layout-reviewers, mats
diff --git a/css/css-sizing/intrinsic-percent-replaced-010-ref.html b/css/css-sizing/intrinsic-percent-replaced-010-ref.html
new file mode 100644
index 0000000..761f18c
--- /dev/null
+++ b/css/css-sizing/intrinsic-percent-replaced-010-ref.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<title>CSS Test Reference</title>
+<div style="display: inline-block">
+  <img style="height: 100px; max-width: 100%;" src="/images/green-100x50.png">
+</div>
diff --git a/css/css-sizing/intrinsic-percent-replaced-010.html b/css/css-sizing/intrinsic-percent-replaced-010.html
new file mode 100644
index 0000000..c0a8186
--- /dev/null
+++ b/css/css-sizing/intrinsic-percent-replaced-010.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Percentage size abspos box in a containing block that has padding</title>
+<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=1691374">
+<link rel=author href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel=author href="https://mozilla.org" title="Mozilla">
+<link rel=match href="intrinsic-percent-replaced-010-ref.html">
+<div style="position: relative; padding-top: 100px; height: 0;">
+  <div style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;">
+    <div style="display: inline-block; height: 100%;">
+      <img
+        style="height: 100%; max-width: 100%;"
+        src="/images/green-100x50.png">
+    </div>
+  </div>
+</div>
diff --git a/css/css-sizing/intrinsic-percent-replaced-011-ref.html b/css/css-sizing/intrinsic-percent-replaced-011-ref.html
new file mode 100644
index 0000000..29a0fe8
--- /dev/null
+++ b/css/css-sizing/intrinsic-percent-replaced-011-ref.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<title>CSS Test Reference</title>
+<div style="writing-mode: vertical-lr">
+  <div style="display: inline-block">
+    <img style="width: 100px; max-height: 100%;" src="/images/green-100x50.png">
+  </div>
+</div>
diff --git a/css/css-sizing/intrinsic-percent-replaced-011.html b/css/css-sizing/intrinsic-percent-replaced-011.html
new file mode 100644
index 0000000..4c0a11f
--- /dev/null
+++ b/css/css-sizing/intrinsic-percent-replaced-011.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Percentage size abspos box in a containing block that has padding</title>
+<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=1691374">
+<link rel=author href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel=author href="https://mozilla.org" title="Mozilla">
+<link rel=match href="intrinsic-percent-replaced-011-ref.html">
+<style>
+  :root { writing-mode: vertical-lr; }
+</style>
+<div style="position: relative; padding-left: 100px; width: 0;">
+  <div style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;">
+    <div style="display: inline-block; width: 100%;">
+      <img
+        style="width: 100%; max-height: 100%;"
+        src="/images/green-100x50.png">
+    </div>
+  </div>
+</div>