From db4cb14953713e85acf6990bea41053b2242907f Mon Sep 17 00:00:00 2001 From: "satorux@chromium.org" Date: Wed, 31 Mar 2010 10:16:50 +0000 Subject: Fix a bug that caused single-line labels to be line-wrapped with Views for Linux. Change Label::GetTextSize() to compute |w| with std::numeric_limits::max() in the single line mode, just like it used to be before r42527. BUG=39799 TEST=Confirmed labels are not line-wrapped in candidate_window with the fix. Review URL: http://codereview.chromium.org/1542005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43200 0039d316-1c4b-4281-b951-d872f2087c98 --- views/controls/label.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'views/controls/label.cc') 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 +#include #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::max(); int h = font_.height(); // For single-line strings, ignore the available width and calculate how // wide the text wants to be. -- cgit v1.1