diff options
Diffstat (limited to 'views/controls/label.cc')
-rw-r--r-- | views/controls/label.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/views/controls/label.cc b/views/controls/label.cc index f73740e..16b1802 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -5,6 +5,7 @@ #include "views/controls/label.h" #include <cmath> +#include <limits> #include "app/l10n_util.h" #include "app/resource_bundle.h" @@ -374,7 +375,12 @@ gfx::Rect Label::GetTextBounds() const { gfx::Size Label::GetTextSize() const { if (!text_size_valid_) { - int w = GetAvailableRect().width(); + // For single-line strings, we supply the largest possible width, because + // while adding NO_ELLIPSIS to the flags works on Windows for forcing + // SizeStringInt() to calculate the desired width, it doesn't seem to work + // on Linux. + int w = is_multi_line_ ? + GetAvailableRect().width() : std::numeric_limits<int>::max(); int h = font_.height(); // For single-line strings, ignore the available width and calculate how // wide the text wants to be. |