blob: 3bc8655a812143e29100eaa93ae33e4fa19291ee [file] [edit]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/ui-helper.js"></script>
<style>
body {
height: 2000px;
}
#target {
position: fixed;
top: 100px;
width: 100px;
height: 200px;
background-color: silver;
}
</style>
<body onload="runTest()">
<div id="target"></div>
</body>
<script>
jsTestIsAsync = true;
let largestDelta = 0;
async function runTest()
{
description("Verifies that getBoundingClientRect() on a fixedpos always returns the layout value.");
window.addEventListener('scroll', () => {
const targetTop = document.getElementById('target').getBoundingClientRect().top;
largestDelta = Math.max(largestDelta, Math.abs(targetTop - 100));
}, false);
if (!window.testRunner)
return;
await UIHelper.dragFromPointToPoint(150, 300, 150, 50, 0.1);
await UIHelper.waitForTargetScrollAnimationToSettle(document.scrollingElement);
shouldBe("largestDelta", "0");
finishJSTest();
}
</script>
</html>