summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Label.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibGUI/Label.cpp')
-rw-r--r--Userland/Libraries/LibGUI/Label.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/Label.cpp b/Userland/Libraries/LibGUI/Label.cpp
index 37b106b58a..ca9f6e026e 100644
--- a/Userland/Libraries/LibGUI/Label.cpp
+++ b/Userland/Libraries/LibGUI/Label.cpp
@@ -23,7 +23,7 @@ Label::Label(DeprecatedString text)
REGISTER_TEXT_WRAPPING_PROPERTY("text_wrapping", text_wrapping, set_text_wrapping);
set_preferred_size({ SpecialDimension::OpportunisticGrow });
- set_min_height(22);
+ set_min_size({ SpecialDimension::Shrink });
set_frame_thickness(0);
set_frame_shadow(Gfx::FrameShadow::Plain);
@@ -129,4 +129,14 @@ Optional<UISize> Label::calculated_preferred_size() const
return GUI::UISize(text_calculated_preferred_width(), text_calculated_preferred_height());
}
+Optional<UISize> Label::calculated_min_size() const
+{
+ int frame = frame_thickness() * 2;
+ int width = font().width_rounded_up("..."sv) + frame;
+ int height = font().pixel_size_rounded_up() + frame;
+ height = max(height, 22);
+
+ return UISize(width, height);
+}
+
}