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

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

Issue 953093003: Cleanup unnecessary code in canvas_skia (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/views/controls/label.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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 ClearCaches(); 192 ClearCaches();
193 } 193 }
194 194
195 int InnerBoundedLabel::GetTextFlags() { 195 int InnerBoundedLabel::GetTextFlags() {
196 int flags = gfx::Canvas::MULTI_LINE | gfx::Canvas::CHARACTER_BREAK; 196 int flags = gfx::Canvas::MULTI_LINE | gfx::Canvas::CHARACTER_BREAK;
197 197
198 // We can't use subpixel rendering if the background is non-opaque. 198 // We can't use subpixel rendering if the background is non-opaque.
199 if (SkColorGetA(background_color()) != 0xFF) 199 if (SkColorGetA(background_color()) != 0xFF)
200 flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING; 200 flags |= gfx::Canvas::NO_SUBPIXEL_RENDERING;
201 201
202 const base::i18n::TextDirection direction = 202 return flags | gfx::Canvas::TEXT_ALIGN_TO_HEAD;
203 base::i18n::GetFirstStrongCharacterDirection(text());
204 if (direction == base::i18n::RIGHT_TO_LEFT)
205 return flags | gfx::Canvas::FORCE_RTL_DIRECTIONALITY;
206 return flags | gfx::Canvas::FORCE_LTR_DIRECTIONALITY;
207 } 203 }
208 204
209 void InnerBoundedLabel::ClearCaches() { 205 void InnerBoundedLabel::ClearCaches() {
210 wrapped_text_width_ = 0; 206 wrapped_text_width_ = 0;
211 wrapped_text_lines_ = 0; 207 wrapped_text_lines_ = 0;
212 lines_cache_.clear(); 208 lines_cache_.clear();
213 lines_widths_.clear(); 209 lines_widths_.clear();
214 size_cache_.clear(); 210 size_cache_.clear();
215 size_widths_and_lines_.clear(); 211 size_widths_and_lines_.clear();
216 } 212 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 339
344 void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) { 340 void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) {
345 label_->SetNativeTheme(theme); 341 label_->SetNativeTheme(theme);
346 } 342 }
347 343
348 base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) { 344 base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) {
349 return JoinString(label_->GetWrappedText(width, lines), '\n'); 345 return JoinString(label_->GetWrappedText(width, lines), '\n');
350 } 346 }
351 347
352 } // namespace message_center 348 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698