summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-anchor-position/position-fallback-002.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-anchor-position/position-fallback-002.html
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-anchor-position/position-fallback-002.html')
-rw-r--r--testing/web-platform/tests/css/css-anchor-position/position-fallback-002.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-anchor-position/position-fallback-002.html b/testing/web-platform/tests/css/css-anchor-position/position-fallback-002.html
new file mode 100644
index 0000000000..52c964609b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-anchor-position/position-fallback-002.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<title>Tests that overflowing the inset-modified containing block triggers position fallback</title>
+<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#fallback">
+<link rel="author" href="mailto:xiaochengh@chromium.org">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/check-layout-th.js"></script>
+<style>
+.cb {
+ width: 400px;
+ height: 400px;
+ transform: scale(1);
+ background: yellow;
+}
+.anchor1 {
+ anchor-name: --a;
+ margin-left: 100px;
+ width: 100px;
+ height: 100px;
+ background: blue;
+}
+.target {
+ position: absolute;
+ position-fallback: --fallback;
+ width: min-content;
+ height: 100px;
+ background: orange;
+}
+.inline-spacer {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+}
+@position-fallback --fallback {
+ @try { /* 1: Position to the left of the anchor. */
+ left: 0;
+ right: anchor(--a left);
+ top: anchor(--a top);
+ }
+ @try { /* 2: Position to the right of the anchor. */
+ left: anchor(--a right);
+ right: 0;
+ top: anchor(--a top);
+ }
+ @try { /* 3: Placeholder fallback that shouldn't be selected when the previous
+ ones do not overflow the available space. */
+ inset: 0;
+ }
+}
+</style>
+<body onload="checkLayout('.target')">
+ <!-- The first `@try` overflows the inset-modifed containing block -->
+ <div class="cb">
+ <div class="anchor1"></div>
+ <div class="target"
+ data-offset-x=200 data-offset-y=0
+ data-expected-width=200 data-expected-height=100>
+ <span class="inline-spacer"></span>
+ </div>
+ </div>
+</body>