LibWeb: Don't always stop drawing scrollbar on mouseleave
Some checks failed
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Build Dev Container Image / build (push) Has been cancelled

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
commit a60debe7bb
Notes: github-actions[bot] 2025-08-20 00:13:02 +00:00

View file

@ -1049,6 +1049,11 @@ Paintable::DispatchEventOfSameName PaintableBox::handle_mousemove(Badge<EventHan
void PaintableBox::handle_mouseleave(Badge<EventHandler>) 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; auto previous_draw_enlarged_horizontal_scrollbar = m_draw_enlarged_horizontal_scrollbar;
m_draw_enlarged_horizontal_scrollbar = false; m_draw_enlarged_horizontal_scrollbar = false;
if (previous_draw_enlarged_horizontal_scrollbar != m_draw_enlarged_horizontal_scrollbar) if (previous_draw_enlarged_horizontal_scrollbar != m_draw_enlarged_horizontal_scrollbar)