mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibGUI: Limit ScrollableWidget::available_size() width/height to 0
The current implementation is lying, it returns negative values if the inner rect has a zero width or height but also a scrollbar - which doesn't mean there's a "negative size" available though; it's still "no size available", i.e. 0.
This commit is contained in:
parent
b97a900595
commit
d1e1cfc133
Notes:
sideshowbarker
2024-07-19 01:30:25 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/d1e1cfc1331 Pull-request: https://github.com/SerenityOS/serenity/pull/3997
@ -101,8 +101,8 @@ void ScrollableWidget::resize_event(ResizeEvent& event)
|
||||
|
||||
Gfx::IntSize ScrollableWidget::available_size() const
|
||||
{
|
||||
int available_width = frame_inner_rect().width() - m_size_occupied_by_fixed_elements.width() - width_occupied_by_vertical_scrollbar();
|
||||
int available_height = frame_inner_rect().height() - m_size_occupied_by_fixed_elements.height() - height_occupied_by_horizontal_scrollbar();
|
||||
unsigned available_width = max(frame_inner_rect().width() - m_size_occupied_by_fixed_elements.width() - width_occupied_by_vertical_scrollbar(), 0);
|
||||
unsigned available_height = max(frame_inner_rect().height() - m_size_occupied_by_fixed_elements.height() - height_occupied_by_horizontal_scrollbar(), 0);
|
||||
return { available_width, available_height };
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user