diff options
author | Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | 2022-10-19 13:46:48 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-10-19 16:11:15 +0200 |
commit | dfc3a4772b0d3fc330ef9c77e566f78a4922ead8 (patch) | |
tree | 1745e309ec78c8b006f08ca7fbb1f7173de880dc /Userland/Libraries | |
parent | f39b6ae3c672d639f65af4a296bcfd7fca43e5fe (diff) | |
download | serenity-dfc3a4772b0d3fc330ef9c77e566f78a4922ead8.zip |
LibWeb: Ignore "pointer-events: none" elements in hit_test
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/Page/EventHandler.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/StackingContext.cpp | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index f26b839eea..f60d7c624b 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -280,7 +280,6 @@ bool EventHandler::handle_mousedown(Gfx::IntPoint const& position, unsigned butt JS::GCPtr<DOM::Node> node; { - // TODO: Allow selecting element behind if one on top has pointer-events set to none. RefPtr<Painting::Paintable> paintable; if (m_mouse_event_tracking_layout_node) { paintable = m_mouse_event_tracking_layout_node->paintable(); @@ -293,8 +292,7 @@ bool EventHandler::handle_mousedown(Gfx::IntPoint const& position, unsigned butt auto pointer_events = paintable->computed_values().pointer_events(); // FIXME: Handle other values for pointer-events. - if (pointer_events == CSS::PointerEvents::None) - return false; + VERIFY(pointer_events != CSS::PointerEvents::None); node = paintable->mouse_event_target(); if (!node) @@ -414,8 +412,7 @@ bool EventHandler::handle_mousemove(Gfx::IntPoint const& position, unsigned butt auto pointer_events = paintable->computed_values().pointer_events(); // FIXME: Handle other values for pointer-events. - if (pointer_events == CSS::PointerEvents::None) - return false; + VERIFY(pointer_events != CSS::PointerEvents::None); hovered_node_changed = node.ptr() != document.hovered_node(); document.set_hovered_node(node); @@ -497,7 +494,6 @@ bool EventHandler::handle_doubleclick(Gfx::IntPoint const& position, unsigned bu if (!paint_root()) return false; - // TODO: Allow selecting element behind if one on top has pointer-events set to none. RefPtr<Painting::Paintable> paintable; if (m_mouse_event_tracking_layout_node) { paintable = m_mouse_event_tracking_layout_node->paintable(); diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 60b84e43d0..d07271d1c2 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -379,6 +379,10 @@ Optional<HitTestResult> StackingContext::hit_test(Gfx::FloatPoint const& positio return {}; } + if (paintable().computed_values().pointer_events() == CSS::PointerEvents::None) { + return {}; + } + // NOTE: Hit testing basically happens in reverse painting order. // https://www.w3.org/TR/CSS22/visuren.html#z-index |