diff options
author | Andreas Kling <kling@serenityos.org> | 2022-03-21 15:43:37 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-21 15:43:37 +0100 |
commit | 196a3eb239a0e7c1ced45c4957b2aa230056c179 (patch) | |
tree | 85d764744a2bcc77aa82b0cb7b4594a9a29df91f /Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | |
parent | df8ef03957d5a9918562af3c039b83433aff7db3 (diff) | |
download | serenity-196a3eb239a0e7c1ced45c4957b2aa230056c179.zip |
LibWeb: Ignore invisible boxes and stacking contexts during hit testing
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting/PaintableBox.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 5e512dc12f..9684c1aa8f 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -464,6 +464,9 @@ void PaintableBox::set_stacking_context(NonnullOwnPtr<StackingContext> stacking_ Optional<HitTestResult> PaintableBox::hit_test(Gfx::FloatPoint const& position, HitTestType type) const { + if (!is_visible()) + return {}; + if (layout_box().is_initial_containing_block_box()) { const_cast<Layout::InitialContainingBlock&>(static_cast<Layout::InitialContainingBlock const&>(layout_box())).build_stacking_context_tree_if_needed(); return stacking_context()->hit_test(position, type); @@ -497,7 +500,7 @@ Optional<HitTestResult> PaintableWithLines::hit_test(const Gfx::FloatPoint& posi if (type == HitTestType::TextCursor && last_good_candidate.has_value()) return last_good_candidate; - if (absolute_border_box_rect().contains(position.x(), position.y())) + if (is_visible() && absolute_border_box_rect().contains(position.x(), position.y())) return HitTestResult { *this }; return {}; } |