mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibWeb: Avoid division by zero when calculating scrollbar rect
This commit is contained in:
parent
0afbd827e0
commit
a40c14462d
Notes:
sideshowbarker
2024-07-17 10:31:19 +09:00
Author: https://github.com/tcl3
Commit: a40c14462d
Pull-request: https://github.com/SerenityOS/serenity/pull/23616
3 changed files with 16 additions and 0 deletions
|
@ -276,6 +276,8 @@ Optional<CSSPixelRect> PaintableBox::scroll_thumb_rect(ScrollDirection direction
|
|||
auto scroll_overflow_size = direction == ScrollDirection::Horizontal ? scrollable_overflow_rect.width() : scrollable_overflow_rect.height();
|
||||
auto scrollport_size = direction == ScrollDirection::Horizontal ? padding_rect.width() : padding_rect.height();
|
||||
auto scroll_offset = direction == ScrollDirection::Horizontal ? this->scroll_offset().x() : this->scroll_offset().y();
|
||||
if (scroll_overflow_size == 0)
|
||||
return {};
|
||||
|
||||
auto thumb_size = scrollport_size * (scrollport_size / scroll_overflow_size);
|
||||
CSSPixels thumb_position = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue