LibWeb: Don't always stop drawing scrollbar on mouseleave

PaintableBox::handle_mouseleave is turning off scrollbar updating, but
the user might still have the primary button down to scroll. Don't turn
it off if grabbing the thumb to scroll.

Resolves crashing on MacOSX AppKit and Qt where gutter_size is 0 when
mouse is moved outside window.
This commit is contained in:
Rocco Corsi 2025-08-16 17:57:35 -04:00 committed by Tim Flynn
parent 658477620a
commit a60debe7bb

View File

@ -1049,6 +1049,11 @@ Paintable::DispatchEventOfSameName PaintableBox::handle_mousemove(Badge<EventHan
void PaintableBox::handle_mouseleave(Badge<EventHandler>)
{
// FIXME: early return needed as MacOSX calls this even when user is pressing mouse button
// https://github.com/LadybirdBrowser/ladybird/issues/5844
if (m_scroll_thumb_dragging_direction.has_value())
return;
auto previous_draw_enlarged_horizontal_scrollbar = m_draw_enlarged_horizontal_scrollbar;
m_draw_enlarged_horizontal_scrollbar = false;
if (previous_draw_enlarged_horizontal_scrollbar != m_draw_enlarged_horizontal_scrollbar)