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

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

Issue 10695101: Remove code that forces text directionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove directionality forcing and modes; may be incorrect... 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
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 <limits> 7 #include <limits>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // localized so their directionality should be set as DT_RTLREADING if it 123 // localized so their directionality should be set as DT_RTLREADING if it
124 // contains strong RTL characters. 124 // contains strong RTL characters.
125 // 125 //
126 // Caveat: If the string is purely LTR, don't set DTL_RTLREADING since when 126 // Caveat: If the string is purely LTR, don't set DTL_RTLREADING since when
127 // the flag is set, LRE-PDF don't have the desired effect of rendering 127 // the flag is set, LRE-PDF don't have the desired effect of rendering
128 // multiline English-only text as LTR. 128 // multiline English-only text as LTR.
129 // 129 //
130 // Note that if the caller is explicitly requesting displaying the text 130 // Note that if the caller is explicitly requesting displaying the text
131 // using RTL directionality then we respect that and pass DT_RTLREADING to 131 // using RTL directionality then we respect that and pass DT_RTLREADING to
132 // ::DrawText even if the locale is LTR. 132 // ::DrawText even if the locale is LTR.
133 int force_rtl = (flags & gfx::Canvas::FORCE_RTL_DIRECTIONALITY); 133 //
134 int force_ltr = (flags & gfx::Canvas::FORCE_LTR_DIRECTIONALITY); 134 // TODO(asvitkine): Deprecate this file...
135 int force_rtl = 0; // (flags & gfx::Canvas::FORCE_RTL_DIRECTIONALITY);
136 int force_ltr = 0; // (flags & gfx::Canvas::FORCE_LTR_DIRECTIONALITY);
135 bool is_rtl = base::i18n::IsRTL(); 137 bool is_rtl = base::i18n::IsRTL();
136 bool string_contains_strong_rtl_chars = 138 bool string_contains_strong_rtl_chars =
137 base::i18n::StringContainsStrongRTLChars(text); 139 base::i18n::StringContainsStrongRTLChars(text);
138 if (force_rtl || (!force_ltr && is_rtl && string_contains_strong_rtl_chars)) 140 if (force_rtl || (!force_ltr && is_rtl && string_contains_strong_rtl_chars))
139 f |= DT_RTLREADING; 141 f |= DT_RTLREADING;
140 142
141 return f; 143 return f;
142 } 144 }
143 145
144 // Changes the alpha of the given bitmap. 146 // Changes the alpha of the given bitmap.
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 ClipRect(solid_part); 576 ClipRect(solid_part);
575 DrawStringInt(text, font, color, 577 DrawStringInt(text, font, color,
576 text_rect.x(), text_rect.y(), 578 text_rect.x(), text_rect.y(),
577 text_rect.width(), text_rect.height(), 579 text_rect.width(), text_rect.height(),
578 flags); 580 flags);
579 canvas_->restore(); 581 canvas_->restore();
580 canvas_->restore(); 582 canvas_->restore();
581 } 583 }
582 584
583 } // namespace gfx 585 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/views/controls/label.h » ('j') | ui/views/controls/label.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698