blob: 168936be2d40a1df1b231912e32eae592c1f5ea8 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<style>
#container {
position: absolute;
direction: rtl;
width: 400px;
height: 400px;
overflow: auto;
scroll-snap-type: both mandatory;
left: 0px;
top: 0px;
margin: 0;
padding: 0;
}
::-webkit-scrollbar {
display: none;
}
.cell {
width: 400px;
height: 400px;
margin: 0px;
padding: 0px;
position: absolute;
}
#top-left {
scroll-snap-align: end;
}
#middle {
scroll-snap-align: center;
}
#bottom-right {
scroll-snap-align: start;
}
.green {
background-color: green;
}
.red {
background-color: red;
}
</style>
<script src="../../resources/js-test.js"></script>
<script>
function run() {
jsTestIsAsync = true;
if (!window.testRunner || !window.internals) {
debug(`To manually test, verify that scrolling in the container snaps so that each colored box can fill
the scroll container.`);
return;
}
setTimeout(() => {
debug(`The scroll offsets are: ${internals.scrollSnapOffsets(container)}`);
finishJSTest();
}, 0);
}
</script>
</head>
<body onload=run()>
<div id="container">
<div style="top: 0px; left: 0px;" class="cell green" id="top-left"></div>
<div style="top: 0px; left: -400px;" class="cell red"></div>
<div style="top: 0px; left: -800px;" class="cell green"></div><br/>
<div style="top: 400px; left: 0px;" class="cell red"></div>
<div style="top: 400px; left: -400px;" class="cell green" id="middle"></div>
<div style="top: 400px; left: -800px;" class="cell red"></div><br/>
<div style="top: 800px; left: 0px;" class="cell green"></div>
<div style="top: 800px; left: -400px;" class="cell red"></div>
<div style="top: 800px; left: -800px;" class="cell green" id="bottom-right"></div>
</div>
<div id="output"></div>
</body>
</html>