Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/controls/styled_label.h" | 5 #include "ui/views/controls/styled_label.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 } | 92 } |
| 93 | 93 |
| 94 | 94 |
| 95 // StyledLabel ---------------------------------------------------------------- | 95 // StyledLabel ---------------------------------------------------------------- |
| 96 | 96 |
| 97 // static | 97 // static |
| 98 const char StyledLabel::kViewClassName[] = "StyledLabel"; | 98 const char StyledLabel::kViewClassName[] = "StyledLabel"; |
| 99 | 99 |
| 100 StyledLabel::StyledLabel(const base::string16& text, | 100 StyledLabel::StyledLabel(const base::string16& text, |
| 101 StyledLabelListener* listener) | 101 StyledLabelListener* listener) |
| 102 : specified_line_height_(0), | 102 : font_list_(Label().font_list()), |
|
tapted
2016/03/08 12:25:43
There's an alternative to this in patchset 2 - whi
| |
| 103 specified_line_height_(0), | |
| 103 listener_(listener), | 104 listener_(listener), |
| 104 width_at_last_size_calculation_(0), | 105 width_at_last_size_calculation_(0), |
| 105 width_at_last_layout_(0), | 106 width_at_last_layout_(0), |
| 106 displayed_on_background_color_(SkColorSetRGB(0xFF, 0xFF, 0xFF)), | 107 displayed_on_background_color_(SkColorSetRGB(0xFF, 0xFF, 0xFF)), |
| 107 displayed_on_background_color_set_(false), | 108 displayed_on_background_color_set_(false), |
| 108 auto_color_readability_enabled_(true) { | 109 auto_color_readability_enabled_(true) { |
| 109 base::TrimWhitespace(text, base::TRIM_TRAILING, &text_); | 110 base::TrimWhitespace(text, base::TRIM_TRAILING, &text_); |
| 110 } | 111 } |
| 111 | 112 |
| 112 StyledLabel::~StyledLabel() {} | 113 StyledLabel::~StyledLabel() {} |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 DCHECK_LE(used_width, width); | 373 DCHECK_LE(used_width, width); |
| 373 // The user-specified line height only applies to interline spacing, so the | 374 // The user-specified line height only applies to interline spacing, so the |
| 374 // final line's height is unaffected. | 375 // final line's height is unaffected. |
| 375 int total_height = line * line_height + | 376 int total_height = line * line_height + |
| 376 CalculateLineHeight(font_list_) + GetInsets().height(); | 377 CalculateLineHeight(font_list_) + GetInsets().height(); |
| 377 calculated_size_ = gfx::Size(used_width + GetInsets().width(), total_height); | 378 calculated_size_ = gfx::Size(used_width + GetInsets().width(), total_height); |
| 378 return calculated_size_; | 379 return calculated_size_; |
| 379 } | 380 } |
| 380 | 381 |
| 381 } // namespace views | 382 } // namespace views |
| OLD | NEW |