LibWeb: Fix context menu and select dropdown position in iframe

This commit is contained in:
Psychpsyo 2025-01-14 03:14:22 +01:00 committed by Sam Atkins
commit d5c21301db
Notes: github-actions[bot] 2025-01-22 12:26:46 +00:00
2 changed files with 7 additions and 5 deletions

View file

@ -2152,13 +2152,14 @@ CSSPixelRect Navigable::to_top_level_rect(CSSPixelRect const& a_rect)
CSSPixelPoint Navigable::to_top_level_position(CSSPixelPoint a_position)
{
auto position = a_position;
for (auto ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
for (auto ancestor = this; ancestor; ancestor = ancestor->parent()) {
if (is<TraversableNavigable>(*ancestor))
break;
if (!ancestor->container())
return {};
if (!ancestor->container()->paintable())
return {};
// FIXME: Handle CSS transforms that might affect the ancestor.
position.translate_by(ancestor->container()->paintable()->box_type_agnostic_position());
}
return position;