mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:37:44 +00:00
LibWeb: Limit scroll position by overflow area in Window::scroll()
This change fixes "vertical shift" in inspector.
This commit is contained in:
parent
de993be02f
commit
4969ad9d6b
3 changed files with 42 additions and 7 deletions
1
Tests/LibWeb/Text/expected/window-scrollTo.txt
Normal file
1
Tests/LibWeb/Text/expected/window-scrollTo.txt
Normal file
|
@ -0,0 +1 @@
|
|||
The page has been scrolled to y: 1616
|
28
Tests/LibWeb/Text/input/window-scrollTo.html
Normal file
28
Tests/LibWeb/Text/input/window-scrollTo.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
<style>
|
||||
div {
|
||||
width: 1000px;
|
||||
height: 1000px;
|
||||
border: 50px solid magenta;
|
||||
}
|
||||
|
||||
#a {
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
#b {
|
||||
background-color: blue;
|
||||
}
|
||||
</style>
|
||||
<script src="include.js"></script>
|
||||
<script>
|
||||
asyncTest(done => {
|
||||
document.addEventListener("scroll", (event) => {
|
||||
println("The page has been scrolled to y: " + window.scrollY);
|
||||
done();
|
||||
});
|
||||
|
||||
window.scrollTo(0, 2000);
|
||||
});
|
||||
</script>
|
||||
<div id="a"></div>
|
||||
<div id="b"></div>
|
Loading…
Add table
Add a link
Reference in a new issue