diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/nested-supercedes-common-to-both-axes.html | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/nested-supercedes-common-to-both-axes.html')
-rw-r--r-- | testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/nested-supercedes-common-to-both-axes.html | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/nested-supercedes-common-to-both-axes.html b/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/nested-supercedes-common-to-both-axes.html new file mode 100644 index 0000000000..15743026bc --- /dev/null +++ b/testing/web-platform/tests/css/css-scroll-snap/snap-after-relayout/multiple-aligned-targets/nested-supercedes-common-to-both-axes.html @@ -0,0 +1,91 @@ +<!DOCTYPE html> +<html> + <head> + <link rel="help" href="https://drafts.csswg.org/css-scroll-snap"/> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/dom/events/scrolling/scroll_support.js"></script> + <script src="/resources/testdriver.js"></script> + <script src="/resources/testdriver-actions.js"></script> + <script src="/resources/testdriver-vendor.js"></script> + <script src="resources/common.js" ></script> + </head> + <body> + <style> + .scroller { + overflow: scroll; + width: 450px; + height: 450px; + border: solid 1px black; + scroll-snap-type: both mandatory; + position: relative; + resize: both; + } + .large-space { + height: 300vh; + width: 300vw; + position: absolute; + } + .snap { + scroll-snap-align: start; + } + .box { + width: 200px; + height: 200px; + background-color: green; + position: absolute; + } + .inner { + width: 50px; + height: 50px; + background-color: yellow; + } + #box2 { + top: 0px; + left: 100px; + } + #box3 { + top: 100px; + left: 0px; + } + </style> + <div class="scroller" id="scroller"> + <div class="large-space"><div> + <div id="box1" class="snap box">Box 1</div> + <div id="box2" class="inner snap box">Box 2</div> + <div id="box3" class="inner snap box">Box 3</div> + </div> + <script> + window.onload = () => { + const scroller = document.getElementById("scroller"); + const boxes = document.querySelectorAll(".snap.box"); + function box(n) { + return boxes[n - 1]; + } + + promise_test(async (t) => { + await waitForCompositorCommit(); + + // Box 2 should be selected as the target in the y axis despite Box 1's + // being a common target in both axes because Box 2 is nested within + // Box 1. + await runScrollSnapSelectionVerificationTest(t, scroller, + /*aligned_elements_x=*/[], + /*aligned_elements_y=*/[box(1), box(2)], + /*axis=*/ "y", + /*expected_target_x=*/null, + /*expected_target_y=*/box(2)); + + // Box 3 should be selected as the target in the x axis despite Box 1's + // being a common target in both axes because Box 3 is nested within + // Box 1. + await runScrollSnapSelectionVerificationTest(t, scroller, + /*aligned_elements_x=*/[box(1), box(3)], + /*aligned_elements_y=*/[], + /*axis=*/"x", + /*expected_target_x=*/box(3)); + }, "scroller prefers nested area over area aligned in both axes."); + } + </script> + </body> +</html> |