mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +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:
parent
f7a900367f
commit
392b055806
8 changed files with 36 additions and 1 deletions
|
@ -61,6 +61,25 @@ void StackingContext::paint(PaintContext& context, LayoutNode::PaintPhase phase)
|
|||
}
|
||||
}
|
||||
|
||||
HitTestResult StackingContext::hit_test(const Gfx::IntPoint& position) const
|
||||
{
|
||||
HitTestResult result;
|
||||
if (!m_box.is_root()) {
|
||||
result = m_box.hit_test(position);
|
||||
} else {
|
||||
// NOTE: LayoutDocument::hit_test() merely calls StackingContext::hit_test()
|
||||
// so we call its base class instead.
|
||||
result = to<LayoutDocument>(m_box).LayoutBlock::hit_test(position);
|
||||
}
|
||||
|
||||
for (auto* child : m_children) {
|
||||
auto result_here = child->hit_test(position);
|
||||
if (result_here.layout_node)
|
||||
result = result_here;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void StackingContext::dump(int indent) const
|
||||
{
|
||||
for (int i = 0; i < indent; ++i)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue