mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +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.
30 lines
728 B
HTML
30 lines
728 B
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>
|
|
<script src="include.js"></script>
|
|
<script>
|
|
asyncTest(async (done) => {
|
|
document.body.offsetWidth; // force layout
|
|
|
|
println(`before: ${vertical.scrollTop}`);
|
|
|
|
const rect = vertical.getBoundingClientRect();
|
|
internals.mouseDown(rect.x + 10, rect.y + 10);
|
|
internals.mouseMove(rect.x + 10, rect.y + rect.height + 50);
|
|
|
|
await timeout(1000);
|
|
|
|
println(`after: ${vertical.scrollTop}`);
|
|
|
|
internals.mouseUp(rect.x + 10, rect.y + rect.height + 50);
|
|
done();
|
|
});
|
|
</script>
|