Chromium Code Reviews| Index: ui/views/controls/styled_label.cc |
| diff --git a/ui/views/controls/styled_label.cc b/ui/views/controls/styled_label.cc |
| index f875c7f36c68e6d35158e670d08c27ac97ff2cde..f377c7da52f98ca4f2cf01432b965d9c958835d0 100644 |
| --- a/ui/views/controls/styled_label.cc |
| +++ b/ui/views/controls/styled_label.cc |
| @@ -46,6 +46,11 @@ void StyledLabel::AddLink(const ui::Range& range) { |
| InvalidateLayout(); |
| } |
| +void StyledLabel::SizeToFit(int width) { |
|
sky
2013/03/18 19:32:39
I'm not a fan of this method, it's too easy to use
tbarzic
2013/03/18 20:40:03
ok, removed
|
| + SetBounds(x(), y(), width, GetHeightForWidth(width)); |
| + InvalidateLayout(); |
| +} |
| + |
| gfx::Insets StyledLabel::GetInsets() const { |
| gfx::Insets insets = View::GetInsets(); |
| const gfx::Insets focus_border_padding(1, 1, 1, 1); |
| @@ -53,6 +58,10 @@ gfx::Insets StyledLabel::GetInsets() const { |
| return insets; |
| } |
| +gfx::Size StyledLabel::GetPreferredSize() { |
| + return gfx::Size(width(), GetHeightForWidth(width())); |
|
sky
2013/03/18 19:32:39
This isn't right. If you need the preferred size f
tbarzic
2013/03/18 20:40:03
Done.
|
| +} |
| + |
| int StyledLabel::GetHeightForWidth(int w) { |
| if (w != calculated_size_.width()) |
| calculated_size_ = gfx::Size(w, CalculateAndDoLayout(w, true)); |