1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

LibWeb: Test nested elements in InlinePaintable::hit_test()

Before this change we were ignoring nested paintables inside inline
paintable during hit-testing, but now we recurse into subtree.

Fixes https://github.com/SerenityOS/serenity/issues/22927
This commit is contained in:
Aliaksandr Kalenik 2024-01-25 15:06:34 +01:00 committed by Andreas Kling
parent 1583e6ce07
commit c02820759b
4 changed files with 37 additions and 1 deletions

View file

@ -173,7 +173,19 @@ Optional<HitTestResult> InlinePaintable::hit_test(CSSPixelPoint position, HitTes
fragment.text_index_at(position.x()) };
}
}
return {};
Optional<HitTestResult> hit_test_result;
for_each_child([&](Paintable const& child) {
if (child.stacking_context())
return IterationDecision::Continue;
if (auto result = child.hit_test(position, type); result.has_value()) {
hit_test_result = result;
return IterationDecision::Break;
}
return IterationDecision::Continue;
});
return hit_test_result;
}
CSSPixelRect InlinePaintable::bounding_rect() const