1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:37:35 +00:00

LibWeb: Always check paintable boxes children during hit-testing

Children of a paintable box are not guaranteed to be contained within
its border box. Therefore, during hit-testing, we must always check
them.

Fixes https://github.com/SerenityOS/serenity/issues/23219
This commit is contained in:
Aliaksandr Kalenik 2024-03-05 13:46:03 +01:00 committed by Andreas Kling
parent c1dbde72e9
commit 16f33aafda
5 changed files with 49 additions and 3 deletions

View file

@ -861,9 +861,6 @@ TraversalDecision PaintableBox::hit_test(CSSPixelPoint position, HitTestType typ
return stacking_context()->hit_test(position, type, callback);
}
if (!absolute_border_box_rect().contains(position_adjusted_by_scroll_offset.x(), position_adjusted_by_scroll_offset.y()))
return TraversalDecision::Continue;
for (auto const* child = last_child(); child; child = child->previous_sibling()) {
auto z_index = child->computed_values().z_index();
if (child->layout_node().is_positioned() && z_index.value_or(0) == 0)
@ -872,6 +869,9 @@ TraversalDecision PaintableBox::hit_test(CSSPixelPoint position, HitTestType typ
return TraversalDecision::Break;
}
if (!absolute_border_box_rect().contains(position_adjusted_by_scroll_offset.x(), position_adjusted_by_scroll_offset.y()))
return TraversalDecision::Continue;
if (!visible_for_hit_testing())
return TraversalDecision::Continue;