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

Side by Side Diff: lib/i18n/bidi_formatter.dart

Issue 10692022: Reapply r9192 and 9194, with the change of making locale a public field. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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 | lib/i18n/bidi_utils.dart » ('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 Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('bidi_formatter');
6
7 #import('bidi_utils.dart');
8
9 /** 5 /**
10 * Bidi stands for Bi-directional text. 6 * Bidi stands for Bi-directional text.
11 * According to http://en.wikipedia.org/wiki/Bi-directional_text: 7 * According to [Wikipedia](http://en.wikipedia.org/wiki/Bi-directional_text):
12 * Bi-directional text is text containing text in both text directionalities, 8 * Bi-directional text is text containing text in both text directionalities,
13 * both right-to-left (RTL) and left-to-right (LTR). It generally involves text 9 * both right-to-left (RTL) and left-to-right (LTR). It generally involves text
14 * containing different types of alphabets, but may also refer to boustrophedon, 10 * containing different types of alphabets, but may also refer to boustrophedon,
15 * which is changing text directionality in each row. 11 * which is changing text directionality in each row.
16 * 12 *
17 * Utility class for formatting display text in a potentially 13 * Utility class for formatting display text in a potentially
18 * opposite-directionality context without garbling layout issues. 14 * opposite-directionality context without garbling layout issues.
19 * Mostly a very "slimmed-down" and dart-ified port of the Closure Birectional 15 * Mostly a very "slimmed-down" and dart-ified port of the Closure Birectional
20 * formatting libary. If there is a utility in the Closure library (or ICU, or 16 * formatting libary. If there is a utility in the Closure library (or ICU, or
21 * elsewhere) that you would like this formatter to make available, please 17 * elsewhere) that you would like this formatter to make available, please
(...skipping 28 matching lines...) Expand all
50 * attacks and other nasty business. This of course is always true, but the 46 * attacks and other nasty business. This of course is always true, but the
51 * escaping cannot be done after the string has already been wrapped in 47 * escaping cannot be done after the string has already been wrapped in
52 * mark-up, so the BiDi formatter also serves as a last chance and includes 48 * mark-up, so the BiDi formatter also serves as a last chance and includes
53 * escaping services. 49 * escaping services.
54 * 50 *
55 * Thus, in a single call, the formatter will escape the input string as 51 * Thus, in a single call, the formatter will escape the input string as
56 * specified, determine its directionality, and wrap it as necessary. It is 52 * specified, determine its directionality, and wrap it as necessary. It is
57 * then up to the caller to insert the return value in the output. 53 * then up to the caller to insert the return value in the output.
58 */ 54 */
59 55
60 #import('dart:web');
61
62 class BidiFormatter { 56 class BidiFormatter {
63 57
64 /** The direction of the surrounding text (the context). */ 58 /** The direction of the surrounding text (the context). */
65 TextDirection contextDirection; 59 TextDirection contextDirection;
66 60
67 /** 61 /**
68 * Indicates if we should always wrap the formatted text in a <span<,. 62 * Indicates if we should always wrap the formatted text in a <span<,.
69 */ 63 */
70 bool _alwaysSpan; 64 bool _alwaysSpan;
71 65
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (contextDirection == TextDirection.LTR) { 173 if (contextDirection == TextDirection.LTR) {
180 return BidiUtils.LRM; 174 return BidiUtils.LRM;
181 } else { 175 } else {
182 return BidiUtils.RLM; 176 return BidiUtils.RLM;
183 } 177 }
184 } else { 178 } else {
185 return ''; 179 return '';
186 } 180 }
187 } 181 }
188 } 182 }
OLDNEW
« no previous file with comments | « no previous file | lib/i18n/bidi_utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698