<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<div id="scroller" style="width: 400px; height: 400px; overflow: scroll">
<div id="space" style="width: 400px; height: 2000px"></div>
</div>
<script>
var scroller = document.getElementById("scroller");
promise_test (async () => {
const scrollendPromise = waitForScrollendEvent(scroller);
scroller.scrollTo({top: 1500, behavior: 'smooth'});
scroller.style.height = "1000px";
await scrollendPromise;
var expected = scroller.scrollHeight - scroller.clientHeight;
assert_equals(scroller.scrollTop, expected);
}, "Clamps the scroll offset if the scroller's size is changed during animation.");
</script>