mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
Add a test case that was reduced from a regression discovered and fixed during the AccumulatedVisualContext refactoring. The test verifies that hit-testing works correctly when an absolutely positioned element is inside an overflow:hidden container and the viewport has been scrolled.
38 lines
812 B
HTML
38 lines
812 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
}
|
|
.spacer {
|
|
height: 1000px;
|
|
}
|
|
.container {
|
|
position: relative;
|
|
overflow: hidden;
|
|
width: 200px;
|
|
height: 100px;
|
|
}
|
|
#target {
|
|
position: absolute;
|
|
top: 10px;
|
|
left: 10px;
|
|
width: 50px;
|
|
height: 50px;
|
|
background: black;
|
|
}
|
|
</style>
|
|
<div class="spacer"></div>
|
|
<div class="container">
|
|
<div id="target"></div>
|
|
</div>
|
|
<script>
|
|
window.scrollTo(0, 1000);
|
|
test(() => {
|
|
const target = document.getElementById("target");
|
|
const rect = target.getBoundingClientRect();
|
|
const hitNode = internals.hitTest(rect.x + 10, rect.y + 10).node;
|
|
println(hitNode === target);
|
|
});
|
|
</script>
|