LibWeb: Add minimum thumb size

This change is intended to insure that the thumb control on the dialog
will never be narrower than 50 pixels no matter how long the line it's
displaying.
This commit is contained in:
Onorio Catenacci 2024-08-27 20:34:21 -04:00 committed by Alexander Kalenik
parent e2ff234ac2
commit b86f57ebf7
Notes: github-actions[bot] 2024-08-30 11:33:25 +00:00

View file

@ -279,8 +279,8 @@ Optional<PaintableBox::ScrollbarData> PaintableBox::compute_scrollbar_data(Scrol
auto scrollport_size = direction == ScrollDirection::Horizontal ? padding_rect.width() : padding_rect.height();
if (scroll_overflow_size == 0)
return {};
auto thumb_length = scrollport_size * (scrollport_size / scroll_overflow_size);
auto const min_thumb_length = 50;
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);