Tests/LibWeb: Add hit test for border-radius clip

This test demonstrates that hit testing incorrectly hits elements
in areas clipped by border-radius. The corner point (5,5) should
not hit the target element because it falls outside the rounded
corner, but currently it does.
This commit is contained in:
Aliaksandr Kalenik
2026-01-19 07:19:00 +01:00
committed by Jelle Raaijmakers
parent 44bfb32d47
commit 0db9ce6131
Notes: github-actions[bot] 2026-02-06 11:19:18 +00:00
2 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<!DOCTYPE html>
<script src="include.js"></script>
<style>
#target {
width: 200px;
height: 200px;
background: blue;
border-radius: 50px;
position: absolute;
top: 0;
left: 0;
cursor: pointer;
}
</style>
<div id="target"></div>
<script>
test(() => {
// Corner at (5,5) - outside due to border-radius
let hit1 = internals.hitTest(5, 5);
// Inside ellipse curve
let hit2 = internals.hitTest(25, 25);
// Center
let hit3 = internals.hitTest(100, 100);
println("Corner (5,5):");
printElement(hit1.node);
println("Near corner (25,25):");
printElement(hit2.node);
println("Center (100,100):");
printElement(hit3.node);
});
</script>