summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Layout/LayoutBox.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-01 19:02:28 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-01 19:10:58 +0200
commit392b05580690b271d21dde89a9f9b2b05988f234 (patch)
tree2834e39d37bf47e46b299b5277d6f64a81fb2bae /Libraries/LibWeb/Layout/LayoutBox.cpp
parentf7a900367f802796d94742c5bbb272aa07b4450e (diff)
downloadserenity-392b05580690b271d21dde89a9f9b2b05988f234.zip
LibWeb: Use the StackingContext tree for hit testing
This makes it possible to click links that are above other content due to stacking context order (e.g via CSS z-index.)
Diffstat (limited to 'Libraries/LibWeb/Layout/LayoutBox.cpp')
-rw-r--r--Libraries/LibWeb/Layout/LayoutBox.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutBox.cpp b/Libraries/LibWeb/Layout/LayoutBox.cpp
index cfddbf21bd..4e84d22324 100644
--- a/Libraries/LibWeb/Layout/LayoutBox.cpp
+++ b/Libraries/LibWeb/Layout/LayoutBox.cpp
@@ -231,6 +231,8 @@ HitTestResult LayoutBox::hit_test(const Gfx::IntPoint& position) const
// m_rect.contains() since inline text rects can't be trusted..
HitTestResult result { absolute_rect().contains(position.x(), position.y()) ? this : nullptr };
for_each_child([&](auto& child) {
+ if (is<LayoutBox>(child) && to<LayoutBox>(child).stacking_context())
+ return;
auto child_result = child.hit_test(position);
if (child_result.layout_node)
result = child_result;