Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(727)

Unified Diff: views/controls/label.cc

Issue 354014: Fullscreen Exit Bubble should not elide its label.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/label.cc
===================================================================
--- views/controls/label.cc (revision 30386)
+++ views/controls/label.cc (working copy)
@@ -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 @@
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698