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

Unified Diff: ui/message_center/views/bounded_label.cc

Issue 14322007: Add line height setting to views::Label & use it for notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 8 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 | « ui/message_center/views/bounded_label.h ('k') | ui/message_center/views/notification_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/bounded_label.cc
diff --git a/ui/message_center/views/bounded_label.cc b/ui/message_center/views/bounded_label.cc
index e419da9a21b89f0b91991a41a8700bf1b938f79e..42c1b3c1328bd631e5b5f8f97ff2aa442cbc2711 100644
--- a/ui/message_center/views/bounded_label.cc
+++ b/ui/message_center/views/bounded_label.cc
@@ -113,7 +113,9 @@ gfx::Size InnerBoundedLabel::GetSizeForWidthAndLines(int width, int lines) {
int text_height = std::numeric_limits<int>::max();
std::vector<string16> wrapped = GetWrappedText(text_width, lines);
gfx::Canvas::SizeStringInt(JoinString(wrapped, '\n'), font(),
- &text_width, &text_height, GetTextFlags());
+ &text_width, &text_height,
+ owner_->GetLineHeight(),
+ GetTextFlags());
size.set_width(text_width + insets.width());
size.set_height(text_height + insets.height());
SetCachedSize(key, size);
@@ -167,7 +169,7 @@ void InnerBoundedLabel::OnPaint(gfx::Canvas* canvas) {
views::Label::OnPaintBackground(canvas);
views::Label::OnPaintFocusBorder(canvas);
views::Label::OnPaintBorder(canvas);
- int lines = owner_->line_limit();
+ int lines = owner_->GetLineLimit();
int height = GetSizeForWidthAndLines(width(), lines).height();
if (height > 0) {
gfx::Rect bounds(width(), height);
@@ -275,10 +277,22 @@ void BoundedLabel::SetColors(SkColor textColor, SkColor backgroundColor) {
label_->SetBackgroundColor(backgroundColor);
}
+void BoundedLabel::SetLineHeight(int height) {
+ label_->SetLineHeight(height);
+}
+
void BoundedLabel::SetLineLimit(int lines) {
line_limit_ = std::max(lines, -1);
}
+int BoundedLabel::GetLineHeight() const {
+ return label_->line_height();
+}
+
+int BoundedLabel::GetLineLimit() const {
+ return line_limit_;
+}
+
int BoundedLabel::GetLinesForWidthAndLimit(int width, int limit) {
return visible() ? label_->GetLinesForWidthAndLimit(width, limit) : 0;
}
« no previous file with comments | « ui/message_center/views/bounded_label.h ('k') | ui/message_center/views/notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698