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

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

Issue 10743002: Fix fade-truncation of LTR tab titles under RTL UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 desired_characters_to_truncate_from_head, 454 desired_characters_to_truncate_from_head,
455 text.length()); 455 text.length());
456 clipped_text = text.substr(desired_characters_to_truncate_from_head); 456 clipped_text = text.substr(desired_characters_to_truncate_from_head);
457 } 457 }
458 458
459 render_text->set_fade_tail(true); 459 render_text->set_fade_tail(true);
460 render_text->set_fade_head(true); 460 render_text->set_fade_head(true);
461 break; 461 break;
462 } 462 }
463 463
464 // Default to left alignment unless right alignment was chosen above.
465 if (!(flags & TEXT_ALIGN_RIGHT))
466 flags |= TEXT_ALIGN_LEFT;
467
464 gfx::Rect rect = display_rect; 468 gfx::Rect rect = display_rect;
465 UpdateRenderText(rect, clipped_text, font, flags, color, render_text.get()); 469 UpdateRenderText(rect, clipped_text, font, flags, color, render_text.get());
466 470
467 const int line_height = render_text->GetStringSize().height(); 471 const int line_height = render_text->GetStringSize().height();
468 rect.Offset(0, VAlignText(line_height, flags, display_rect.height())); 472 rect.Offset(0, VAlignText(line_height, flags, display_rect.height()));
469 rect.set_height(line_height); 473 rect.set_height(line_height);
470 render_text->SetDisplayRect(rect); 474 render_text->SetDisplayRect(rect);
471 475
472 canvas_->save(SkCanvas::kClip_SaveFlag); 476 canvas_->save(SkCanvas::kClip_SaveFlag);
473 ClipRect(display_rect); 477 ClipRect(display_rect);
474 render_text->Draw(this); 478 render_text->Draw(this);
475 canvas_->restore(); 479 canvas_->restore();
476 } 480 }
477 481
478 } // namespace gfx 482 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698