summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-03 21:01:04 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-03 21:01:04 +0000
commit3470a325a84b16c3f38eedb2cc062e5ad0706399 (patch)
treed36e7307231d6619cc7120e22c3ffdd82fdce1fd /views
parent0b6bf5e8e267315b6802a60c0fae3bcd03bd1e63 (diff)
downloadchromium_src-3470a325a84b16c3f38eedb2cc062e5ad0706399.zip
chromium_src-3470a325a84b16c3f38eedb2cc062e5ad0706399.tar.gz
chromium_src-3470a325a84b16c3f38eedb2cc062e5ad0706399.tar.bz2
Fullscreen Exit Bubble should not elide its label.
When drawing a Label it is important to adjust for RTL not just when drawing, but also when computing the size of the string. Before this change, we'd compute using Font::GetStringWidth (which uses ::GetTextExtentPoint32 *without* adjusting the string for RTL) and draw using DoDrawText (which adjusts for RTL and then draws using ::DrawText). After this change, we now use SizeStringInt for computing (so we now compute and draw using the same ::DrawText function, thereby adjusting the string for RTL in both cases). BUG=17949 TEST=Run chrome with --lang=he, press F11 and the string in the bubble at the top should not be elided. Review URL: http://codereview.chromium.org/354014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30863 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rwxr-xr-xviews/controls/label.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/views/controls/label.cc b/views/controls/label.cc
index 6da6c48..2f25aad 100755
--- a/views/controls/label.cc
+++ b/views/controls/label.cc
@@ -5,6 +5,7 @@
#include "views/controls/label.h"
#include <math.h>
+#include <limits>
#include "app/gfx/canvas.h"
#include "app/gfx/color_utils.h"
@@ -264,7 +265,12 @@ const GURL Label::GetURL() const {
gfx::Size Label::GetTextSize() {
if (!text_size_valid_) {
- text_size_.SetSize(font_.GetStringWidth(text_), font_.height());
+ // Multi-line labels need a boundary width (see GetHeightForWidth).
+ DCHECK(!is_multi_line_);
+ int h = 0, w = std::numeric_limits<int>::max();
+ gfx::Canvas cc(0, 0, true);
+ cc.SizeStringInt(text_, font_, &w, &h, 0);
+ text_size_.SetSize(w, font_.height());
if (highlighted_)
text_size_.Enlarge(1, 1);
text_size_valid_ = true;