diff options
author | Andreas Kling <kling@serenityos.org> | 2021-10-19 12:53:22 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-19 12:53:22 +0200 |
commit | fcff6b716042f1c95dad78c41301c44b2c056279 (patch) | |
tree | 9f83c4e87552216b368a895bfe5b1c479b28da1a /Userland/Libraries/LibWeb/Page | |
parent | defe4d50ff299be543f8470120ff678207e7cf6d (diff) | |
download | serenity-fcff6b716042f1c95dad78c41301c44b2c056279.zip |
LibWeb: Don't assume we hit a layout node when handling mousedown events
Regression from the introduction of CSS pointer-events in
ec43f7a2b0840a97c6d093066750dd28840d9587.
Diffstat (limited to 'Userland/Libraries/LibWeb/Page')
-rw-r--r-- | Userland/Libraries/LibWeb/Page/EventHandler.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index 2544585ec1..17744f14fb 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -184,19 +184,18 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt } NonnullRefPtr document = *m_frame.active_document(); - - // TODO: Allow selecting element behind if one on top has pointer-events set to none. - auto result = layout_root()->hit_test(position, Layout::HitTestType::Exact); - auto pointer_events = result.layout_node->computed_values().pointer_events(); - if (pointer_events == CSS::PointerEvents::None) - return false; - RefPtr<DOM::Node> node; { + // TODO: Allow selecting element behind if one on top has pointer-events set to none. + auto result = layout_root()->hit_test(position, Layout::HitTestType::Exact); if (!result.layout_node) return false; + auto pointer_events = result.layout_node->computed_values().pointer_events(); + if (pointer_events == CSS::PointerEvents::None) + return false; + node = result.layout_node->dom_node(); document->set_hovered_node(node); |