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

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

Issue 10693061: Fix RenderTextWin base dir and adjacent char code; remove test exceptions; etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. 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 | ui/gfx/render_text_unittest.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 (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"
11 #include "ui/base/text/text_elider.h" 11 #include "ui/base/text/text_elider.h"
12 #include "ui/gfx/font.h" 12 #include "ui/gfx/font.h"
13 #include "ui/gfx/font_list.h" 13 #include "ui/gfx/font_list.h"
14 #include "ui/gfx/insets.h" 14 #include "ui/gfx/insets.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 #include "ui/gfx/render_text.h" 16 #include "ui/gfx/render_text.h"
17 #include "ui/gfx/shadow_value.h" 17 #include "ui/gfx/shadow_value.h"
18 #include "ui/gfx/skia_util.h" 18 #include "ui/gfx/skia_util.h"
19 19
20 namespace { 20 namespace {
21 21
22 // If necessary, wraps |text| with RTL/LTR directionality characters based on 22 // If necessary, wraps |text| with RTL/LTR directionality characters based on
23 // |flags| and |text| content. 23 // |flags| and |text| content.
24 // Returns true if the text will be rendered right-to-left. 24 // Returns true if the text will be rendered right-to-left.
25 // TODO(asvitkine): Support setting directionality directly on RenderText, so 25 // TODO(msw): Nix this, now that RenderTextWin supports directionality directly.
26 // that wrapping the text is not needed.
27 bool AdjustStringDirection(int flags, string16* text) { 26 bool AdjustStringDirection(int flags, string16* text) {
27 // TODO(msw): FORCE_LTR_DIRECTIONALITY does not work for RTL text now.
28
28 // If the string is empty or LTR was forced, simply return false since the 29 // If the string is empty or LTR was forced, simply return false since the
29 // default RenderText directionality is already LTR. 30 // default RenderText directionality is already LTR.
30 if (text->empty() || (flags & gfx::Canvas::FORCE_LTR_DIRECTIONALITY)) 31 if (text->empty() || (flags & gfx::Canvas::FORCE_LTR_DIRECTIONALITY))
31 return false; 32 return false;
32 33
33 // If RTL is forced, apply it to the string. 34 // If RTL is forced, apply it to the string.
34 if (flags & gfx::Canvas::FORCE_RTL_DIRECTIONALITY) { 35 if (flags & gfx::Canvas::FORCE_RTL_DIRECTIONALITY) {
35 base::i18n::WrapStringWithRTLFormatting(text); 36 base::i18n::WrapStringWithRTLFormatting(text);
36 return true; 37 return true;
37 } 38 }
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 rect.set_height(line_height); 469 rect.set_height(line_height);
469 render_text->SetDisplayRect(rect); 470 render_text->SetDisplayRect(rect);
470 471
471 canvas_->save(SkCanvas::kClip_SaveFlag); 472 canvas_->save(SkCanvas::kClip_SaveFlag);
472 ClipRect(display_rect); 473 ClipRect(display_rect);
473 render_text->Draw(this); 474 render_text->Draw(this);
474 canvas_->restore(); 475 canvas_->restore();
475 } 476 }
476 477
477 } // namespace gfx 478 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698