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

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

Issue 712003005: Support vertical centering of multi-line labels. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update multi-line label unittests. Created 6 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 | ui/views/controls/label_unittest.cc » ('j') | 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 1078d0b5a8a84e7ae22165cd2eb6e4a7065e6e4c..9d71a98bcbe4c25f5668d908465889ced72d2ed3 100644
--- a/ui/views/controls/label.cc
+++ b/ui/views/controls/label.cc
@@ -437,7 +437,10 @@ gfx::Rect Label::GetTextBounds() const {
NOTREACHED();
break;
}
- text_size.set_height(available.height());
+ if (!multi_line_)
+ text_size.set_height(available.height());
+ // Support vertical centering of multi-line labels: http://crbug.com/429595
+ origin.Offset(0, std::max(0, (available.height() - text_size.height())) / 2);
return gfx::Rect(origin, text_size);
}
« no previous file with comments | « no previous file | ui/views/controls/label_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698