diff options
Diffstat (limited to 'Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp b/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp index c0abe4af61..761ae2332b 100644 --- a/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp +++ b/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp @@ -37,25 +37,22 @@ void ScrollableContainerWidget::update_widget_size() if (!m_widget) return; m_widget->do_layout(); + auto new_size = Widget::content_size(); if (m_widget->is_shrink_to_fit() && m_widget->layout()) { - 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()); if (preferred_size.height() != -1) new_size.set_height(preferred_size.height()); - m_widget->resize(new_size); - set_content_size(new_size); } else { - auto inner_size = Widget::content_size(); auto min_size = m_widget->min_size(); - auto new_size = Gfx::Size { - max(inner_size.width(), min_size.width()), - max(inner_size.height(), min_size.height()) + new_size = Gfx::Size { + max(new_size.width(), min_size.width()), + max(new_size.height(), min_size.height()) }; - m_widget->resize(new_size); - set_content_size(new_size); } + m_widget->resize(new_size); + set_content_size(new_size); } void ScrollableContainerWidget::resize_event(GUI::ResizeEvent& event) |