1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
<!DOCTYPE html>
<title>Tests fallback positions that overflow the inset-modified containing block regardless of scrolling</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>
<script src="support/test-common.js"></script>
<style>
body { margin: 0; }
.ltr { direction: ltr; }
.rtl { direction: rtl; }
.vrl { writing-mode: vertical-rl; }
.vlr { writing-mode: vertical-lr; }
.cb {
width: 200px;
height: 200px;
transform: scale(1);
}
.spacer {
block-size: 50px;
}
.anchor {
width: 100px;
height: 100px;
margin-inline-start: 50px;
background: orange;
anchor-name: --a;
}
.anchored {
position: absolute;
width: 50px;
height: 50px;
background: lime;
}
/* Used on a element whose block and inline axes are the same with its
containing block, so that the first two positions will exceed the end edges
of the IMCB, and the last position will be used. */
.exceeds-end {
position-try-fallbacks: --exceeds-end-1, --exceeds-end-2;
left: 0;
right: anchor(--a left);
width: 100px;
}
@position-try --exceeds-end-1 {
inset: auto;
top: 0;
bottom: anchor(--a top);
width: auto;
height: 100px;
}
@position-try --exceeds-end-2 {
inset: auto;
top: 11px;
left: 22px;
width: auto;
height: auto;
}
/* Used on a element whose block and inline axes are in the opposite directions
of its containing block, so that the first two positions will exceed the
start edges of the IMCB, and the last position will be used. */
.exceeds-start {
position-try-fallbacks: --exceeds-start-1, --exceeds-start-2;
bottom: 0;
top: anchor(--a bottom);
height: 100px;
}
@position-try --exceeds-start-1 {
inset: auto;
right: 0;
left: anchor(--a right);
width: 100px;
height: auto;
}
@position-try --exceeds-start-2 {
inset: auto;
top: 11px;
left: 22px;
height: auto;
}
/* Both inset sides are `auto`, but the size is too big to fit in the containing
block. */
.exceeds-size {
position-try-fallbacks: --exceeds-size-1, --exceeds-size-2;
top: anchor(--a bottom);
left: auto;
right: auto;
width: 300px;
}
@position-try --exceeds-size-1 {
inset: auto;
left: anchor(--a right);
width: auto;
height: 300px;
}
@position-try --exceeds-size-2 {
inset: auto;
width: auto;
top: 11px;
left: 22px;
}
</style>
<body onload="checkLayoutForAnchorPos('.anchored')">
<div class=cb>
<div class=spacer></div>
<div class=anchor></div>
<div class="anchored exceeds-end"
data-offset-x=22 data-offset-y=11></div>
</div>
<div class="cb rtl vrl">
<div class=spacer></div>
<div class=anchor></div>
<div class="anchored ltr vlr exceeds-start"
data-offset-x=22 data-offset-y=11></div>
</div>
<div class="cb">
<div class=spacer></div>
<div class=anchor></div>
<div class="anchored exceeds-size"
data-offset-x=22 data-offset-y=11></div>
</div>
</body>
|