mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
LibWeb: Make hit testing traverse positioned descendants in right order
We were doing a forward traversal in hit testing which led to sometimes incorrect results when multiple boxes were occupying the same X and Y coordinate.
This commit is contained in:
parent
f2ccb702e8
commit
5aeb6fec68
3 changed files with 71 additions and 8 deletions
|
@ -62,4 +62,20 @@ Paintable const* Paintable::next_sibling() const
|
|||
return layout_node ? layout_node->paintable() : nullptr;
|
||||
}
|
||||
|
||||
Paintable const* Paintable::last_child() const
|
||||
{
|
||||
auto* layout_child = m_layout_node.last_child();
|
||||
for (; layout_child && !layout_child->paintable(); layout_child = layout_child->previous_sibling())
|
||||
;
|
||||
return layout_child ? layout_child->paintable() : nullptr;
|
||||
}
|
||||
|
||||
Paintable const* Paintable::previous_sibling() const
|
||||
{
|
||||
auto* layout_node = m_layout_node.previous_sibling();
|
||||
for (; layout_node && !layout_node->paintable(); layout_node = layout_node->previous_sibling())
|
||||
;
|
||||
return layout_node ? layout_node->paintable() : nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue