mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
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.
This commit is contained in:
committed by
Alexander Kalenik
parent
7e38e12bb0
commit
60f30aad72
@@ -286,8 +286,10 @@ 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 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);
|
||||
|
||||
Reference in New Issue
Block a user