mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
Previously, hit testing would return early for elements with visibility: hidden, which prevented their visible children from being hit. Now we traverse children even for hidden elements, allowing visible descendants to be hit while still preventing the hidden elements themselves from being hit. The key changes: - PaintableBox::hit_test() and PaintableWithLines::hit_test() no longer return early for hidden elements, but still skip chrome hit testing and the final hit result for them - hit_test_fragments() now checks is_visible() on each fragment's paintable to skip hidden text This matches the CSS specification where visibility is inherited but children can override it with visibility: visible.
22 lines
604 B
HTML
22 lines
604 B
HTML
<!doctype html>
|
|
<body style="margin: 0">
|
|
<style>
|
|
#hidden-parent { visibility: hidden; font-size: 100px; }
|
|
#visible-child { visibility: visible; }
|
|
</style>
|
|
<div id="hidden-parent"><div id="visible-child">LOL</div></div>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
// Hit test in the middle of the visible text inside hidden parent
|
|
const result = internals.hitTest(50, 50);
|
|
if (result && result.node) {
|
|
printElement(result.node);
|
|
printElement(result.node.parentNode);
|
|
} else {
|
|
println("FAIL: no hit test result");
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|