blob: b99980208923f26188f584b9df34314d11ad4d31 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
.horizontalGallery {
width: 300px;
height: 300px;
overflow-y: hidden;
overflow-x: auto;
margin-bottom: 2px;
-webkit-scroll-snap-type: mandatory;
}
.horizontal-good {
-webkit-scroll-snap-points-x: repeat(300px);
}
.horizontal-bad {
-webkit-scroll-snap-points-y: repeat(100vh);
}
.horizontalGalleryDrawer {
width: 1800px;
height: 300px;
}
.colorBox {
height: 300px;
width: 300px;
float: left;
}
#itemH0, #itemV0 { background-color: red; }
#itemH1, #itemV1 { background-color: green; }
#itemH2, #itemV2 { background-color: blue; }
#itemH3, #itemV3 { background-color: aqua; }
#itemH4, #itemV4 { background-color: yellow; }
#itemH5, #itemV5 { background-color: fuchsia; }
</style>
<script src="../../resources/js-test-pre.js"></script>
<script>
function runTest()
{
var badHorizontalTarget = document.getElementById('badHorizontalTarget');
debug("Scroll-snap offsets for 'badHorizontalTarget': " + window.internals.scrollSnapOffsets(badHorizontalTarget));
var horizontalTarget = document.getElementById('horizontalTarget');
debug("Scroll-snap offsets for 'horizontalTarget': " + window.internals.scrollSnapOffsets(horizontalTarget));
finishJSTest();
testRunner.notifyDone();
}
function onLoad()
{
if (window.testRunner) {
window.jsTestIsAsync = true;
testRunner.dumpAsText();
testRunner.waitUntilDone();
setTimeout(runTest, 0);
}
}
</script>
</head>
<body onload="onLoad();">
<div style="position: relative; width: 300px">
<div>Tests that the scroll-snap feature works properly with mixed-up snap points.</div>
<div class="horizontalGallery horizontal-bad" id="badHorizontalTarget">
<div class="horizontalGalleryDrawer">
<div id="itemH0" class="colorBox"></div>
<div id="itemH1" class="colorBox"></div>
<div id="itemH2" class="colorBox"></div>
<div id="itemH3" class="colorBox"></div>
<div id="itemH4" class="colorBox"></div>
<div id="itemH5" class="colorBox"></div>
</div>
</div>
<div class="horizontalGallery horizontal-good" id="horizontalTarget">
<div class="horizontalGalleryDrawer">
<div id="itemH0" class="colorBox"></div>
<div id="itemH1" class="colorBox"></div>
<div id="itemH2" class="colorBox"></div>
<div id="itemH3" class="colorBox"></div>
<div id="itemH4" class="colorBox"></div>
<div id="itemH5" class="colorBox"></div>
</div>
</div>
<div id="console"></div>
</div>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>