| 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/message_center/views/bounded_label.h" | 5 #include "ui/message_center/views/bounded_label.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 ClearCaches(); | 191 ClearCaches(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 int InnerBoundedLabel::GetTextFlags() { | 194 int InnerBoundedLabel::GetTextFlags() { |
| 195 int flags = gfx::Canvas::MULTI_LINE | gfx::Canvas::CHARACTER_BREAK; | 195 int flags = gfx::Canvas::MULTI_LINE | gfx::Canvas::CHARACTER_BREAK; |
| 196 | 196 |
| 197 // We can't use subpixel rendering if the background is non-opaque. | 197 // We can't use subpixel rendering if the background is non-opaque. |
| 198 if (SkColorGetA(background_color()) != 0xFF) | 198 if (SkColorGetA(background_color()) != 0xFF) |
| 199 flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING; | 199 flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING; |
| 200 | 200 |
| 201 if (directionality_mode() == gfx::DIRECTIONALITY_FORCE_LTR) { | 201 if (directionality_mode() == |
| 202 flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; | 202 views::Label::AUTO_DETECT_DIRECTIONALITY) { |
| 203 } else if (directionality_mode() == gfx::DIRECTIONALITY_FORCE_RTL) { | |
| 204 flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; | |
| 205 } else if (directionality_mode() == gfx::DIRECTIONALITY_FROM_TEXT) { | |
| 206 base::i18n::TextDirection direction = | 203 base::i18n::TextDirection direction = |
| 207 base::i18n::GetFirstStrongCharacterDirection(text()); | 204 base::i18n::GetFirstStrongCharacterDirection(text()); |
| 208 if (direction == base::i18n::RIGHT_TO_LEFT) | 205 if (direction == base::i18n::RIGHT_TO_LEFT) |
| 209 flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; | 206 flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; |
| 210 else | 207 else |
| 211 flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; | 208 flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; |
| 212 } | 209 } |
| 213 | 210 |
| 214 return flags; | 211 return flags; |
| 215 } | 212 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 348 |
| 352 void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) { | 349 void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
| 353 label_->SetNativeTheme(theme); | 350 label_->SetNativeTheme(theme); |
| 354 } | 351 } |
| 355 | 352 |
| 356 base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) { | 353 base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) { |
| 357 return JoinString(label_->GetWrappedText(width, lines), '\n'); | 354 return JoinString(label_->GetWrappedText(width, lines), '\n'); |
| 358 } | 355 } |
| 359 | 356 |
| 360 } // namespace message_center | 357 } // namespace message_center |
| OLD | NEW |