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

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

Issue 329813003: Reland: Use labels to display views tab titles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Call AddChildView(title_) on Tab to prevent leaks. 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() == 201 if (directionality_mode() == gfx::DIRECTIONALITY_FORCE_LTR) {
202 views::Label::AUTO_DETECT_DIRECTIONALITY) { 202 flags |= gfx::Canvas::FORCE_LTR_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) {
203 base::i18n::TextDirection direction = 206 base::i18n::TextDirection direction =
204 base::i18n::GetFirstStrongCharacterDirection(text()); 207 base::i18n::GetFirstStrongCharacterDirection(text());
205 if (direction == base::i18n::RIGHT_TO_LEFT) 208 if (direction == base::i18n::RIGHT_TO_LEFT)
206 flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY; 209 flags |= gfx::Canvas::FORCE_RTL_DIRECTIONALITY;
207 else 210 else
208 flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY; 211 flags |= gfx::Canvas::FORCE_LTR_DIRECTIONALITY;
209 } 212 }
210 213
211 return flags; 214 return flags;
212 } 215 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 351
349 void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) { 352 void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) {
350 label_->SetNativeTheme(theme); 353 label_->SetNativeTheme(theme);
351 } 354 }
352 355
353 base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) { 356 base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) {
354 return JoinString(label_->GetWrappedText(width, lines), '\n'); 357 return JoinString(label_->GetWrappedText(width, lines), '\n');
355 } 358 }
356 359
357 } // namespace message_center 360 } // 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