mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibWeb: Use the StackingContext tree for hit testing
This makes it possible to click links that are above other content due to stacking context order (e.g via CSS z-index.)
This commit is contained in:
@@ -231,6 +231,8 @@ HitTestResult LayoutBox::hit_test(const Gfx::IntPoint& position) const
|
||||
// m_rect.contains() since inline text rects can't be trusted..
|
||||
HitTestResult result { absolute_rect().contains(position.x(), position.y()) ? this : nullptr };
|
||||
for_each_child([&](auto& child) {
|
||||
if (is<LayoutBox>(child) && to<LayoutBox>(child).stacking_context())
|
||||
return;
|
||||
auto child_result = child.hit_test(position);
|
||||
if (child_result.layout_node)
|
||||
result = child_result;
|
||||
|
||||
Reference in New Issue
Block a user