LibWeb: Adjust stacking context position by scroll offset in hit-testing

Fixes a bug when stacking contexts nested inside scrollable box are
treated as fixed positioned during hit-testing.
This commit is contained in:
Aliaksandr Kalenik 2024-08-07 16:24:27 +03:00 committed by Alexander Kalenik
commit 53ef0e2e88
Notes: github-actions[bot] 2024-08-07 16:15:32 +00:00
3 changed files with 46 additions and 1 deletions

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
#scrollable-box {
width: 300px;
height: 300px;
border: 1px solid #000;
overflow: auto;
padding: 10px;
}
#inner-box {
width: 100px;
height: 100px;
background-color: #f0f0f0;
border: 1px solid #ccc;
position: relative;
z-index: 1;
}
</style>
<div id="scrollable-box">
<section id="inner-box">
<p>Establishes a stacking context.</p>
</section>
<div id="scroll-space-filler" style="height: 500px"></div>
</div>
<script>
const scrollbox = document.getElementById("scrollable-box");
scrollbox.scrollTop = 200;
test(() => {
printElement(internals.hitTest(50, 50).node);
});
</script>