mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
We only checked if the paintable box had scrollable overflow, but that was too simple - we now use the same logic that checks whether a box can be scrolled by a mousewheel event. The autoscrolling test was updated as well to use rAF+rAF+timeout instead of a fixed 1000ms timeout, which is prone to flakiness.
53 lines
1.4 KiB
HTML
53 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<style>
|
|
div {
|
|
overflow: auto;
|
|
width: 200px;
|
|
height: 100px;
|
|
font-size: 16px;
|
|
}
|
|
</style>
|
|
<div id="vertical">line1<br>line2<br>line3<br>line4<br>line5<br>line6<br>line7<br>line8<br>line9<br>line10</div>
|
|
<div id="hidden" style="overflow: hidden">line1<br>line2<br>line3<br>line4<br>line5<br>line6<br>line7<br>line8<br>line9<br>line10</div>
|
|
<script src="include.js"></script>
|
|
<script>
|
|
function afterAutoScrollTick() {
|
|
return new Promise(resolve => {
|
|
requestAnimationFrame(() => {
|
|
requestAnimationFrame(() => {
|
|
setTimeout(resolve, 0);
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
asyncTest(async (done) => {
|
|
document.body.offsetWidth; // force layout
|
|
|
|
println(`before: ${vertical.scrollTop}`);
|
|
|
|
let rect = vertical.getBoundingClientRect();
|
|
internals.mouseDown(rect.x + 10, rect.y + 10);
|
|
internals.mouseMove(rect.x + 10, rect.y + rect.height + 50);
|
|
|
|
await afterAutoScrollTick();
|
|
|
|
println(`after: ${vertical.scrollTop}`);
|
|
|
|
internals.mouseUp(rect.x + 10, rect.y + rect.height + 50);
|
|
|
|
println(`hidden before: ${hidden.scrollTop}`);
|
|
|
|
rect = hidden.getBoundingClientRect();
|
|
internals.mouseDown(rect.x + 10, rect.y + 10);
|
|
internals.mouseMove(rect.x + 10, rect.y + rect.height + 50);
|
|
|
|
await afterAutoScrollTick();
|
|
|
|
println(`hidden after: ${hidden.scrollTop}`);
|
|
|
|
internals.mouseUp(rect.x + 10, rect.y + rect.height + 50);
|
|
done();
|
|
});
|
|
</script>
|