mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
LibWeb: Make hit testing return a { paintable, offset }
Everything related to hit testing is better off using the painting tree. The thing being mousemoved over is a paintable, so let's hand that out directly instead of the corresponding layout node.
This commit is contained in:
parent
cb0c5390ff
commit
f017c1c064
5 changed files with 46 additions and 49 deletions
|
@ -62,10 +62,10 @@ HitTestResult Box::hit_test(const Gfx::IntPoint& position, HitTestType type) con
|
|||
// FIXME: It would be nice if we could confidently skip over hit testing
|
||||
// parts of the layout tree, but currently we can't just check
|
||||
// m_rect.contains() since inline text rects can't be trusted..
|
||||
HitTestResult result { paint_box()->absolute_border_box_rect().contains(position.x(), position.y()) ? this : nullptr };
|
||||
HitTestResult result { paint_box()->absolute_border_box_rect().contains(position.x(), position.y()) ? paint_box() : nullptr };
|
||||
for_each_child_in_paint_order([&](auto& child) {
|
||||
auto child_result = child.hit_test(position, type);
|
||||
if (child_result.layout_node)
|
||||
if (child_result.paintable)
|
||||
result = child_result;
|
||||
});
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue