1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 07:05:08 +00:00

GScrollableWidget: The visible_content_rect() should be max content_size().

When computing the visible content rect, constrain the result to the content
size. The content shouldn't feel responsible for painting anything outside.
This commit is contained in:
Andreas Kling 2019-04-25 00:05:48 +02:00
parent 7dc4078a73
commit 3543236e8f

View file

@ -96,8 +96,8 @@ Rect GScrollableWidget::visible_content_rect() const
return {
m_horizontal_scrollbar->value(),
m_vertical_scrollbar->value(),
frame_inner_rect().width() - width_occupied_by_vertical_scrollbar() - m_size_occupied_by_fixed_elements.width(),
frame_inner_rect().height() - height_occupied_by_horizontal_scrollbar() - m_size_occupied_by_fixed_elements.height()
min(m_content_size.width(), frame_inner_rect().width() - width_occupied_by_vertical_scrollbar() - m_size_occupied_by_fixed_elements.width()),
min(m_content_size.height(), frame_inner_rect().height() - height_occupied_by_horizontal_scrollbar() - m_size_occupied_by_fixed_elements.height())
};
}