mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
When the mouse is dragged from inside a scrollable container to outside of it, we now automatically scroll the container so the selection can be extended. Scroll speed scales with the distance past the scrollport edge, capped at a maximum. Edges close to the viewport boundary get a wider activation zone so the speed ramp works predictably even when the mouse has limited room to move. The logic is encapsulated in AutoScrollHandler, which EventHandler creates lazily on mouse selection start.
26 lines
488 B
HTML
26 lines
488 B
HTML
<!DOCTYPE html>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
height: 5000px;
|
|
}
|
|
</style>
|
|
<script src="include.js"></script>
|
|
<script>
|
|
asyncTest(async (done) => {
|
|
let scrolled = new Promise(resolve => {
|
|
document.addEventListener("scroll", resolve, { once: true });
|
|
});
|
|
|
|
internals.mouseDown(100, 10);
|
|
internals.mouseMove(100, 610);
|
|
|
|
await scrolled;
|
|
|
|
println(`scrollTop: ${document.documentElement.scrollTop}`);
|
|
|
|
internals.mouseUp(100, 610);
|
|
done();
|
|
});
|
|
</script>
|