mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-02 04:20:28 +00:00
LibWeb: Recurse into block-level children when hit testing a box
Otherwise, we always say you hit the parent, even when you're really clicking on a child that's visually above the parent.
This commit is contained in:
parent
5aeb6fec68
commit
4de3449ad6
Notes:
sideshowbarker
2024-07-17 06:20:50 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4de3449ad6
1 changed files with 12 additions and 3 deletions
|
@ -649,9 +649,18 @@ Optional<HitTestResult> PaintableBox::hit_test(Gfx::FloatPoint const& position,
|
|||
return stacking_context()->hit_test(position, type);
|
||||
}
|
||||
|
||||
if (absolute_border_box_rect().contains(position.x(), position.y()))
|
||||
return HitTestResult { *this };
|
||||
return {};
|
||||
if (!absolute_border_box_rect().contains(position.x(), position.y()))
|
||||
return {};
|
||||
|
||||
for (auto* child = first_child(); child; child = child->next_sibling()) {
|
||||
auto result = child->hit_test(position, type);
|
||||
if (!result.has_value())
|
||||
continue;
|
||||
if (!result->paintable->visible_for_hit_testing())
|
||||
continue;
|
||||
return result;
|
||||
}
|
||||
return HitTestResult { *this };
|
||||
}
|
||||
|
||||
Optional<HitTestResult> PaintableWithLines::hit_test(Gfx::FloatPoint const& position, HitTestType type) const
|
||||
|
|
Loading…
Reference in a new issue