| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/label.h" | 5 #include "ui/views/controls/label.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 void Label::SetHasFocusBorder(bool has_focus_border) { | 175 void Label::SetHasFocusBorder(bool has_focus_border) { |
| 176 has_focus_border_ = has_focus_border; | 176 has_focus_border_ = has_focus_border; |
| 177 if (is_multi_line_) { | 177 if (is_multi_line_) { |
| 178 text_size_valid_ = false; | 178 text_size_valid_ = false; |
| 179 PreferredSizeChanged(); | 179 PreferredSizeChanged(); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 gfx::Insets Label::GetInsets() const { | 183 gfx::Insets Label::GetInsets() const { |
| 184 gfx::Insets insets = View::GetInsets(); | 184 gfx::Insets insets = View::GetInsets(); |
| 185 if (IsFocusable() || has_focus_border_) { | 185 if (focusable() || has_focus_border_) { |
| 186 insets += gfx::Insets(kFocusBorderPadding, kFocusBorderPadding, | 186 insets += gfx::Insets(kFocusBorderPadding, kFocusBorderPadding, |
| 187 kFocusBorderPadding, kFocusBorderPadding); | 187 kFocusBorderPadding, kFocusBorderPadding); |
| 188 } | 188 } |
| 189 return insets; | 189 return insets; |
| 190 } | 190 } |
| 191 | 191 |
| 192 int Label::GetBaseline() const { | 192 int Label::GetBaseline() const { |
| 193 return GetInsets().top() + font_.GetBaseline(); | 193 return GetInsets().top() + font_.GetBaseline(); |
| 194 } | 194 } |
| 195 | 195 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 // it is right aligned. Otherwise, its directionality is forced to be LTR. | 498 // it is right aligned. Otherwise, its directionality is forced to be LTR. |
| 499 if (rtl_alignment_mode_ == AUTO_DETECT_ALIGNMENT) { | 499 if (rtl_alignment_mode_ == AUTO_DETECT_ALIGNMENT) { |
| 500 if (horiz_alignment_ == ALIGN_RIGHT) | 500 if (horiz_alignment_ == ALIGN_RIGHT) |
| 501 *flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; | 501 *flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; |
| 502 else | 502 else |
| 503 *flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; | 503 *flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; |
| 504 } | 504 } |
| 505 } | 505 } |
| 506 | 506 |
| 507 } // namespace views | 507 } // namespace views |
| OLD | NEW |