Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: ui/message_center/views/bounded_label.cc

Issue 327273005: Revert of Use labels to display views tab titles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/text_constants.h ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/gfx/text_constants.h ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698