summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2022-05-07 13:07:53 +0200
committerAndreas Kling <kling@serenityos.org>2022-05-11 20:24:57 +0200
commit9156614de3ed45ec35838a46d6a99d476ed62d67 (patch)
tree393f7eb82c22986d4ba54cabfc56bb722682aad3
parent3e4f912479e4585dc3b7b3ba9a268b5e6163b272 (diff)
downloadserenity-9156614de3ed45ec35838a46d6a99d476ed62d67.zip
LibGUI: Always use widget's minimum size in ScrollableContainerWidget
I don't know if it makes much sense to use min_size and shrink_to_fit at the same time, but it will make the code a bit cleaner later.
-rw-r--r--Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp b/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp
index 761ae2332b..e22d91caa6 100644
--- a/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp
+++ b/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp
@@ -44,13 +44,14 @@ void ScrollableContainerWidget::update_widget_size()
new_size.set_width(preferred_size.width());
if (preferred_size.height() != -1)
new_size.set_height(preferred_size.height());
- } else {
- auto min_size = m_widget->min_size();
- new_size = Gfx::Size {
- max(new_size.width(), min_size.width()),
- max(new_size.height(), min_size.height())
- };
}
+
+ auto min_size = m_widget->min_size();
+ 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);
}