mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Add tests for the implicit root case where targets are inside scroll containers with various overflow types: - overflow:hidden container with target pushed below visible area: should NOT be intersecting (currently wrong, shows intersecting). - overflow:clip container with target pushed below visible area: should NOT be intersecting (currently wrong, shows intersecting). - overflow:hidden container with target at top (visible): should be intersecting (correct). The two failing tests currently reflect wrong behavior because compute_intersection does not clip against intermediate scroll containers when walking the containing block chain.
35 lines
860 B
HTML
35 lines
860 B
HTML
<!DOCTYPE html>
|
|
<style>
|
|
body { margin: 0; }
|
|
#scroller {
|
|
width: 200px;
|
|
height: 200px;
|
|
overflow: hidden;
|
|
}
|
|
#target {
|
|
width: 50px;
|
|
height: 50px;
|
|
background: red;
|
|
}
|
|
</style>
|
|
<script src="../include.js"></script>
|
|
<div id="scroller">
|
|
<div id="target"></div>
|
|
</div>
|
|
<script>
|
|
asyncTest(done => {
|
|
// The target is at the top of a scroll container and visible.
|
|
// With the implicit root, the target SHOULD be intersecting.
|
|
let observer = new IntersectionObserver(entries => {
|
|
entries.forEach(entry => {
|
|
println(`isIntersecting=${entry.isIntersecting}, ratio=${entry.intersectionRatio}`);
|
|
if (entry.isIntersecting) {
|
|
done();
|
|
}
|
|
});
|
|
});
|
|
|
|
observer.observe(document.getElementById("target"));
|
|
});
|
|
</script>
|