LibWeb: Actually hit-test child stacking contents with z-index of 0

Discord modals/pop-outs are in a "layerContainer" <div> with
`z-index: 1002`, which then has an immediate child <div> called
"positionLayer" with `z-index: 0`. We only ever hit test child stacking
contexts with z-index set to anything but 0 (step 7 and step 1 of the
hit test), but not for exactly 0 (step 6). This made it impossible to
hit any element inside positionLayer, making pop-ups such as the emojis
and GIFs unusable.
This commit is contained in:
Luke Wilde 2022-12-09 19:04:55 +00:00 committed by Linus Groh
parent 919aa45017
commit 2b55ccf6e5
Notes: sideshowbarker 2024-07-17 07:43:05 +09:00

View file

@ -500,6 +500,16 @@ Optional<HitTestResult> StackingContext::hit_test(Gfx::FloatPoint position, HitT
if (result.has_value() && result->paintable->visible_for_hit_testing())
return result;
// "child stacking contexts with stack level 0" is first in the step, so last here to match reverse order.
for (ssize_t i = m_children.size() - 1; i >= 0; --i) {
auto const& child = *m_children[i];
if (child.m_box.computed_values().z_index().value_or(0) != 0)
break;
auto result = child.hit_test(transformed_position, type);
if (result.has_value() && result->paintable->visible_for_hit_testing())
return result;
}
// 5. the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.
if (m_box.children_are_inline() && is<Layout::BlockContainer>(m_box)) {
auto result = paintable().hit_test(transformed_position, type);