mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Don't drop mouse wheel events sent to subframes unless handled
Otherwise scrolling gets stuck when you scroll over a non-scrollable subframe.
This commit is contained in:
parent
adeedabf54
commit
f44e42d27c
Notes:
github-actions[bot]
2025-10-07 17:44:24 +00:00
Author: https://github.com/Lubrsi
Commit: f44e42d27c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6419
Reviewed-by: https://github.com/kalenikaliaksandr ✅
1 changed files with 5 additions and 6 deletions
|
|
@ -423,12 +423,11 @@ EventResult EventHandler::handle_mousewheel(CSSPixelPoint viewport_position, CSS
|
||||||
auto node = dom_node_for_event_dispatch(*paintable);
|
auto node = dom_node_for_event_dispatch(*paintable);
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
// FIXME: Support wheel events in nested browsing contexts.
|
if (auto* navigable_container = as_if<HTML::NavigableContainer>(*node)) {
|
||||||
if (is<HTML::HTMLIFrameElement>(*node)) {
|
auto position_in_navigable_container = viewport_position.translated(compute_mouse_event_offset({}, *paintable));
|
||||||
auto& iframe = static_cast<HTML::HTMLIFrameElement&>(*node);
|
auto result = navigable_container->content_navigable()->event_handler().handle_mousewheel(position_in_navigable_container, screen_position, button, buttons, modifiers, wheel_delta_x, wheel_delta_y);
|
||||||
auto position_in_iframe = viewport_position.translated(compute_mouse_event_offset({}, *paintable));
|
if (result == EventResult::Handled)
|
||||||
iframe.content_navigable()->event_handler().handle_mousewheel(position_in_iframe, screen_position, button, buttons, modifiers, wheel_delta_x, wheel_delta_y);
|
return EventResult::Handled;
|
||||||
return EventResult::Dropped;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for the first parent of the hit target that's an element.
|
// Search for the first parent of the hit target that's an element.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue