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

Side by Side Diff: ui/gfx/canvas_skia.cc

Issue 10939010: Cleanup: avoid foo ? true : false, part 1. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 8 years, 2 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/base/win/ime_input.cc ('k') | ui/views/bubble/bubble_border.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gfx/canvas.h" 5 #include "ui/gfx/canvas.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ui/base/range/range.h" 10 #include "ui/base/range/range.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 316 }
317 rect.set_height(line_height); 317 rect.set_height(line_height);
318 318
319 ApplyUnderlineStyle(range, render_text.get()); 319 ApplyUnderlineStyle(range, render_text.get());
320 render_text->SetDisplayRect(rect); 320 render_text->SetDisplayRect(rect);
321 render_text->Draw(this); 321 render_text->Draw(this);
322 rect.Offset(0, line_height); 322 rect.Offset(0, line_height);
323 } 323 }
324 } else { 324 } else {
325 ui::Range range = StripAcceleratorChars(flags, &adjusted_text); 325 ui::Range range = StripAcceleratorChars(flags, &adjusted_text);
326 bool elide_text = (flags & NO_ELLIPSIS) ? false : true; 326 bool elide_text = ((flags & NO_ELLIPSIS) == 0);
327 327
328 #if defined(OS_LINUX) 328 #if defined(OS_LINUX)
329 // On Linux, eliding really means fading the end of the string. But only 329 // On Linux, eliding really means fading the end of the string. But only
330 // for LTR text. RTL text is still elided (on the left) with "...". 330 // for LTR text. RTL text is still elided (on the left) with "...".
331 if (elide_text) { 331 if (elide_text) {
332 render_text->SetText(adjusted_text); 332 render_text->SetText(adjusted_text);
333 if (render_text->GetTextDirection() == base::i18n::LEFT_TO_RIGHT) { 333 if (render_text->GetTextDirection() == base::i18n::LEFT_TO_RIGHT) {
334 render_text->set_fade_tail(true); 334 render_text->set_fade_tail(true);
335 elide_text = false; 335 elide_text = false;
336 } 336 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 rect.set_height(line_height); 470 rect.set_height(line_height);
471 render_text->SetDisplayRect(rect); 471 render_text->SetDisplayRect(rect);
472 472
473 canvas_->save(SkCanvas::kClip_SaveFlag); 473 canvas_->save(SkCanvas::kClip_SaveFlag);
474 ClipRect(display_rect); 474 ClipRect(display_rect);
475 render_text->Draw(this); 475 render_text->Draw(this);
476 canvas_->restore(); 476 canvas_->restore();
477 } 477 }
478 478
479 } // namespace gfx 479 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/base/win/ime_input.cc ('k') | ui/views/bubble/bubble_border.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698