summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-21 15:43:37 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-21 15:43:37 +0100
commit196a3eb239a0e7c1ced45c4957b2aa230056c179 (patch)
tree85d764744a2bcc77aa82b0cb7b4594a9a29df91f /Userland/Libraries/LibWeb/Painting/PaintableBox.cpp
parentdf8ef03957d5a9918562af3c039b83433aff7db3 (diff)
downloadserenity-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.cpp5
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 {};
}