haikuwebkit/LayoutTests/scrollbars/scrolling-backward-by-page-...

77 lines
2.6 KiB
HTML

<html>
<head>
<style>
body {
height: 10000px;
}
#bottom-bar {
position: fixed;
height: 120px;
width: 100%;
background-color: green;
bottom: 0;
left: 0;
}
/* This fixed element does not cover the entire width and should be ignored. */
#ignored-right {
position: fixed;
width: 20px;
height: 5000px;
background-color: red;
right: 0;
top: 0;
}
/* This fixed element does not cover an edge and should be ignored. */
#ignored-center {
position: fixed;
width: 100%;
height: 150px;
background-color: red;
left: 0;
top: 50%;
}
</style>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<div id="bottom-bar"></div>
<div id="ignored-right"></div>
<div id="ignored-center"></div>
<script>
description("Test that scrolling backward by page excludes the area taken by fixed element covering the full width.");
jsTestIsAsync = true;
var failTimeoutId;
function test() {
if (window.eventSender) {
// Force the first layout to avoid the suppressed scrollbar cases.
scratch = document.documentElement.offsetWidth;
scrollBy(0, 1000);
// Avoid special cases for being "onload".
setTimeout(function() {
eventSender.keyDown(' ', ['shiftKey']);
} , 0);
failTimeoutId = setTimeout(function() {
testFailed("The scrollview failed to scroll in response to the event.");
debug("window.scrollY = " + window.scrollY + " excepted value around " + (1000 - (window.innerHeight - 120)));
finishJSTest();
}, 1000);
}
}
window.addEventListener("scroll", function() {
if (window.scrollY == 1000 - (window.innerHeight - 120)) {
testPassed("Scrolled to " + window.scrollY);
clearTimeout(failTimeoutId);
finishJSTest();
}
})
window.addEventListener("load", test);
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>