| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 gfx::Insets StyledLabel::GetInsets() const { | 177 gfx::Insets StyledLabel::GetInsets() const { |
| 178 gfx::Insets insets = View::GetInsets(); | 178 gfx::Insets insets = View::GetInsets(); |
| 179 | 179 |
| 180 // We need a focus border iff we contain a link that will have a focus border. | 180 // We need a focus border iff we contain a link that will have a focus border. |
| 181 // That in turn will be true only if the link is non-empty. | 181 // That in turn will be true only if the link is non-empty. |
| 182 for (StyleRanges::const_iterator i(style_ranges_.begin()); | 182 for (StyleRanges::const_iterator i(style_ranges_.begin()); |
| 183 i != style_ranges_.end(); ++i) { | 183 i != style_ranges_.end(); ++i) { |
| 184 if (i->style_info.is_link && !i->range.is_empty()) { | 184 if (i->style_info.is_link && !i->range.is_empty()) { |
| 185 const gfx::Insets focus_border_padding( | 185 const gfx::Insets focus_border_padding( |
| 186 Label::kFocusBorderPadding, Label::kFocusBorderPadding, | 186 Link::kFocusBorderPadding, Link::kFocusBorderPadding, |
| 187 Label::kFocusBorderPadding, Label::kFocusBorderPadding); | 187 Link::kFocusBorderPadding, Link::kFocusBorderPadding); |
| 188 insets += focus_border_padding; | 188 insets += focus_border_padding; |
| 189 break; | 189 break; |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 return insets; | 193 return insets; |
| 194 } | 194 } |
| 195 | 195 |
| 196 gfx::Size StyledLabel::GetPreferredSize() const { | 196 gfx::Size StyledLabel::GetPreferredSize() const { |
| 197 return calculated_size_; | 197 return calculated_size_; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 DCHECK_LE(used_width, width); | 373 DCHECK_LE(used_width, width); |
| 374 // 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 |
| 375 // final line's height is unaffected. | 375 // final line's height is unaffected. |
| 376 int total_height = line * line_height + | 376 int total_height = line * line_height + |
| 377 CalculateLineHeight(font_list_) + GetInsets().height(); | 377 CalculateLineHeight(font_list_) + GetInsets().height(); |
| 378 calculated_size_ = gfx::Size(used_width + GetInsets().width(), total_height); | 378 calculated_size_ = gfx::Size(used_width + GetInsets().width(), total_height); |
| 379 return calculated_size_; | 379 return calculated_size_; |
| 380 } | 380 } |
| 381 | 381 |
| 382 } // namespace views | 382 } // namespace views |
| OLD | NEW |