Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions css/css-anchor-position/anchor-scroll-position-try-011.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
position-try-fallbacks: --pf1, --pf2, --pf3;
bottom: anchor(top);
left: anchor(right);
position-visibility: always;
}

@position-try --pf1 {
Expand Down Expand Up @@ -85,9 +86,12 @@
assert_fallback_position(anchored, anchor, 'left');
}, 'Should use the last fallback position initially');

const sw = scroller.scrollWidth;
const sh = scroller.scrollHeight;

promise_test(async () => {
// Scroll up to have enough space above the anchor, but not enough right.
scroller.scrollTop = -250;
scroller.scrollTop = -sh;
scroller.scrollLeft = 150;
await waitUntilNextAnimationFrame();
assert_fallback_position(anchored, anchor, 'top');
Expand All @@ -97,16 +101,16 @@
promise_test(async () => {
// Scroll right to have enough space right to the anchor, but not enough above.
scroller.scrollTop = -150;
scroller.scrollLeft = 250;
scroller.scrollLeft = sw;
await waitUntilNextAnimationFrame();
assert_fallback_position(anchored, anchor, 'bottom');
assert_fallback_position(anchored, anchor, 'right');
}, 'Should use the second fallback position with enough space right');

promise_test(async () => {
// Scroll up and right to have enough space on both axes.
scroller.scrollTop = -350;
scroller.scrollLeft = 250;
scroller.scrollTop = -sh;
scroller.scrollLeft = sw;
await waitUntilNextAnimationFrame();
assert_fallback_position(anchored, anchor, 'top');
assert_fallback_position(anchored, anchor, 'right');
Expand Down