mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 10:09:14 +00:00
LibWeb: Find closest scrollable paintable to call handle_mousewheel()
This makes event handler to try to find scrollable paintable in the chain of containing blocks of hit box. This is very naive and will have to be improved in the future.
This commit is contained in:
parent
c7673605bb
commit
3eb9ae4ed5
Notes:
sideshowbarker
2024-07-17 07:09:53 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 3eb9ae4ed5
Pull-request: https://github.com/SerenityOS/serenity/pull/20395
Reviewed-by: https://github.com/MacDue
1 changed files with 9 additions and 0 deletions
|
@ -163,6 +163,15 @@ bool EventHandler::handle_mousewheel(CSSPixelPoint position, unsigned button, un
|
|||
if (auto result = target_for_mouse_position(position); result.has_value())
|
||||
paintable = result->paintable;
|
||||
|
||||
auto* containing_block = paintable->containing_block();
|
||||
while (containing_block) {
|
||||
if (containing_block->is_scrollable()) {
|
||||
const_cast<Painting::PaintableBox*>(containing_block->paintable_box())->handle_mousewheel({}, position, buttons, modifiers, wheel_delta_x * scroll_step_size, wheel_delta_y * scroll_step_size);
|
||||
break;
|
||||
}
|
||||
containing_block = containing_block->containing_block();
|
||||
}
|
||||
|
||||
if (paintable) {
|
||||
paintable->handle_mousewheel({}, position, buttons, modifiers, wheel_delta_x, wheel_delta_y);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue