mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +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:
parent
7e38e12bb0
commit
60f30aad72
Notes:
github-actions[bot]
2024-09-05 23:35:32 +00:00
Author: https://github.com/trflynn89
Commit: 60f30aad72
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1294
1 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue