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

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

Issue 916203002: Reduce the number of text reshaping in RenderText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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/gfx/font_list.h" 10 #include "ui/gfx/font_list.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 } else { 286 } else {
287 Range range = StripAcceleratorChars(flags, &adjusted_text); 287 Range range = StripAcceleratorChars(flags, &adjusted_text);
288 bool elide_text = ((flags & NO_ELLIPSIS) == 0); 288 bool elide_text = ((flags & NO_ELLIPSIS) == 0);
289 289
290 #if defined(OS_LINUX) 290 #if defined(OS_LINUX)
291 // On Linux, eliding really means fading the end of the string. But only 291 // On Linux, eliding really means fading the end of the string. But only
292 // for LTR text. RTL text is still elided (on the left) with "...". 292 // for LTR text. RTL text is still elided (on the left) with "...".
293 if (elide_text) { 293 if (elide_text) {
294 render_text->SetText(adjusted_text); 294 render_text->SetText(adjusted_text);
295 if (render_text->GetTextDirection() == base::i18n::LEFT_TO_RIGHT) { 295 if (render_text->GetDisplayTextDirection() == base::i18n::LEFT_TO_RIGHT) {
296 render_text->SetElideBehavior(FADE_TAIL); 296 render_text->SetElideBehavior(FADE_TAIL);
297 elide_text = false; 297 elide_text = false;
298 } 298 }
299 } 299 }
300 #endif 300 #endif
301 301
302 if (elide_text) { 302 if (elide_text) {
303 ElideTextAndAdjustRange(font_list, 303 ElideTextAndAdjustRange(font_list,
304 static_cast<float>(text_bounds.width()), 304 static_cast<float>(text_bounds.width()),
305 &adjusted_text, &range); 305 &adjusted_text, &range);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 UpdateRenderText(rect, text, font_list, flags, color, render_text.get()); 395 UpdateRenderText(rect, text, font_list, flags, color, render_text.get());
396 render_text->SetElideBehavior(FADE_TAIL); 396 render_text->SetElideBehavior(FADE_TAIL);
397 397
398 canvas_->save(); 398 canvas_->save();
399 ClipRect(display_rect); 399 ClipRect(display_rect);
400 render_text->Draw(this); 400 render_text->Draw(this);
401 canvas_->restore(); 401 canvas_->restore();
402 } 402 }
403 403
404 } // namespace gfx 404 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698