mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
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:
parent
919aa45017
commit
2b55ccf6e5
Notes:
sideshowbarker
2024-07-17 07:43:05 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/2b55ccf6e5 Pull-request: https://github.com/SerenityOS/serenity/pull/16400 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/linusg ✅
1 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue