forked from SerenityOS/serenity
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Do not include box's own scroll offset in get_client_rects()
Fixes SerenityOS#23631
- Loading branch information
1 parent
7b08fd9
commit e232a84
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
...t/expected/IntersectionObserver/observe-box-inside-container-with-scrollable-overflow.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
The box is not visible. | ||
The box is now visible. |
49 changes: 49 additions & 0 deletions
49
...ext/input/IntersectionObserver/observe-box-inside-container-with-scrollable-overflow.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
.scroll-box { | ||
width: 300px; | ||
height: 300px; | ||
overflow: scroll; | ||
border: 2px solid black; | ||
} | ||
|
||
.content-box { | ||
width: 100%; | ||
height: 600px; | ||
position: relative; | ||
} | ||
|
||
.target-box { | ||
width: 100px; | ||
height: 100px; | ||
background-color: red; | ||
position: absolute; | ||
top: 500px; | ||
} | ||
</style> | ||
<script src="../include.js"></script> | ||
<div class="scroll-box"><div class="content-box"><div class="target-box"></div></div></div> | ||
<script> | ||
asyncTest(done => { | ||
function onIntersection(entries) { | ||
entries.forEach((entry) => { | ||
if (entry.isIntersecting) { | ||
println("The box is now visible."); | ||
done(); | ||
} else { | ||
println("The box is not visible."); | ||
} | ||
}); | ||
} | ||
|
||
let observer = new IntersectionObserver(onIntersection, { | ||
root: document.querySelector(".scroll-box"), | ||
}); | ||
|
||
observer.observe(document.querySelector(".target-box")); | ||
|
||
setTimeout(() => { | ||
document.querySelector(".scroll-box").scrollTop = 1000; | ||
}, 100); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters