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

Unified Diff: ui/views/controls/label.cc

Issue 2635103003: [ash-md] Fixed Label::GetTextSize() to account for insets. (Closed)
Patch Set: Added SizeToFit() example use. Created 3 years, 11 months 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 | « ash/common/system/chromeos/screen_security/screen_tray_item.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/label.cc
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc
index 9b04c091ff1ab436580068f0d8a18cb0e9526562..a777d3d35243aa4539bd919b28c8096acc96b2c5 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -904,7 +904,8 @@ gfx::Size Label::GetTextSize() const {
// TODO(mukai): use gfx::Rect() to compute the ideal size rather than
// the current width(). See crbug.com/468494, crbug.com/467526, and
// the comment for MultilinePreferredSizeTest in label_unittest.cc.
- render_text_->SetDisplayRect(gfx::Rect(0, 0, width(), 0));
+ const int available_width = width() - GetInsets().width();
+ render_text_->SetDisplayRect(gfx::Rect(0, 0, available_width, 0));
size = render_text_->GetStringSize();
} else {
// Get the natural text size, unelided and only wrapped on newlines.
« no previous file with comments | « ash/common/system/chromeos/screen_security/screen_tray_item.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698