Browse Source

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.
Timothy Flynn 11 tháng trước cách đây
mục cha
commit
60f30aad72
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      Userland/Libraries/LibWeb/Painting/PaintableBox.cpp

+ 3 - 1
Userland/Libraries/LibWeb/Painting/PaintableBox.cpp

@@ -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);