From 60f30aad7244ee20300f18be9c88c9cf34b9600a Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Thu, 5 Sep 2024 16:28:27 -0400 Subject: [PATCH] LibWeb: Limit the minimum scrollbar size to the overflown box's size A hard-coded value of 50px is too large for text boxes with a size that is less than 50px. Reduce this to 24px, and further limit it by the size of the overflown box. --- Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 6fd2fc27e85..7c1d840be16 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -286,8 +286,10 @@ Optional PaintableBox::compute_scrollbar_data(Scrol auto scrollport_size = direction == ScrollDirection::Horizontal ? padding_rect.width() : padding_rect.height(); if (scroll_overflow_size == 0) return {}; - auto const min_thumb_length = 50; + + auto min_thumb_length = min(scrollport_size, 24); auto thumb_length = max(scrollport_size * (scrollport_size / scroll_overflow_size), min_thumb_length); + CSSPixelFraction scroll_size = 0; if (scroll_overflow_size > scrollport_size) scroll_size = (scrollport_size - thumb_length) / (scroll_overflow_size - scrollport_size);