diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-31 10:16:50 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-31 10:16:50 +0000 |
commit | db4cb14953713e85acf6990bea41053b2242907f (patch) | |
tree | 4dec4e4c795ecaddcbe16e8e7b6a1d4b15b947b7 /views/controls/label.cc | |
parent | 5337ae3c818c2b83c31eedb0729674799cc7f7a1 (diff) | |
download | chromium_src-db4cb14953713e85acf6990bea41053b2242907f.zip chromium_src-db4cb14953713e85acf6990bea41053b2242907f.tar.gz chromium_src-db4cb14953713e85acf6990bea41053b2242907f.tar.bz2 |
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<int>::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
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. |