LibWeb: Check paintable of target against null in mousewheel handling

This commit is contained in:
Andi Gallo 2023-08-09 22:36:46 +00:00 committed by Andreas Kling
parent ae7a0c43a9
commit 670bbf24e5
Notes: sideshowbarker 2024-07-17 08:45:34 +09:00

View File

@ -163,16 +163,16 @@ 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_user_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) {
auto* containing_block = paintable->containing_block();
while (containing_block) {
if (containing_block->is_user_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();
}
paintable->handle_mousewheel({}, position, buttons, modifiers, wheel_delta_x, wheel_delta_y);
auto node = dom_node_for_event_dispatch(*paintable);