1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:58:12 +00:00

LibGUI: ScrollableContainerWidget consider frame

Do not consider the space that is taken up by the frame, as useable
size.
This commit is contained in:
FrHun 2021-09-28 16:25:12 +02:00 committed by Andreas Kling
parent dab7ec190e
commit a59e9a7a81

View file

@ -27,7 +27,7 @@ void ScrollableContainerWidget::update_widget_position()
{
if (!m_widget)
return;
m_widget->move_to(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
m_widget->move_to(-horizontal_scrollbar().value() + content_margins().left(), -vertical_scrollbar().value() + content_margins().top());
}
void ScrollableContainerWidget::update_widget_size()
@ -36,7 +36,7 @@ void ScrollableContainerWidget::update_widget_size()
return;
m_widget->do_layout();
if (m_widget->is_shrink_to_fit() && m_widget->layout()) {
auto new_size = frame_inner_rect().size();
auto new_size = Widget::content_size();
auto preferred_size = m_widget->layout()->preferred_size();
if (preferred_size.width() != -1)
new_size.set_width(preferred_size.width());