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

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

Issue 10700013: revert 9192,9194 (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 | « lib/i18n/bidi_formatter.dart ('k') | lib/i18n/date_format.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_utils');
6
5 /** 7 /**
6 * Bidi stands for Bi-directional text. 8 * Bidi stands for Bi-directional text.
7 * According to http://en.wikipedia.org/wiki/Bi-directional_text: 9 * According to http://en.wikipedia.org/wiki/Bi-directional_text:
8 * Bi-directional text is text containing text in both text directionalities, 10 * Bi-directional text is text containing text in both text directionalities,
9 * both right-to-left (RTL) and left-to-right (LTR). It generally involves text 11 * both right-to-left (RTL) and left-to-right (LTR). It generally involves text
10 * containing different types of alphabets, but may also refer to boustrophedon, 12 * containing different types of alphabets, but may also refer to boustrophedon,
11 * which is changing text directionality in each row. 13 * which is changing text directionality in each row.
12 * 14 *
13 * This file provides some utility classes for determining directionality of 15 * This file provides some utility classes for determining directionality of
14 * text, switching CSS layout from LTR to RTL, and other normalizing utilities 16 * text, switching CSS layout from LTR to RTL, and other normalizing utilities
15 * needed when switching between RTL and LTR formatting. 17 * needed when switching between RTL and LTR formatting.
16 * 18 *
17 * It defines the TextDirection class which is used to represent directionality 19 * It defines the TextDirection class which is used to represent directionality
18 * of text, 20 * of text,
19 * In most cases, it is preferable to use bidi_formatter.dart, which provides 21 * In most cases, it is preferable to use bidi_formatter.dart, which provides
20 * bidi functionality in the given directional context, instead of using 22 * bidi functionality in the given directional context, instead of using
21 * bidi_utils.dart directly. 23 * bidi_utils.dart directly.
22 */ 24 */
25
26 /** Class containing constants to represent the directionality of text. */
23 class TextDirection { 27 class TextDirection {
24 static final LTR = const TextDirection._('LTR', 'ltr'); 28 static final LTR = const TextDirection._('LTR', 'ltr');
25 static final RTL = const TextDirection._('RTL', 'rtl'); 29 static final RTL = const TextDirection._('RTL', 'rtl');
26 // If the directionality of the text cannot be determined and we are not using 30 // If the directionality of the text cannot be determined and we are not using
27 // the context direction (or if the context direction is unknown), then the 31 // the context direction (or if the context direction is unknown), then the
28 // text falls back on the more common ltr direction. 32 // text falls back on the more common ltr direction.
29 static final UNKNOWN = const TextDirection._('UNKNOWN', 'ltr'); 33 static final UNKNOWN = const TextDirection._('UNKNOWN', 'ltr');
30 34
31 /** 35 /**
32 * Textual representation of the directionality constant. One of 36 * Textual representation of the directionality constant. One of
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 388
385 /** 389 /**
386 * Check the directionality of [str], return true if the piece of 390 * Check the directionality of [str], return true if the piece of
387 * text should be laid out in RTL direction. If [isHtml] is true, the string 391 * text should be laid out in RTL direction. If [isHtml] is true, the string
388 * is HTML or HTML-escaped. 392 * is HTML or HTML-escaped.
389 */ 393 */
390 static bool detectRtlDirectionality(String str, [bool isHtml]) { 394 static bool detectRtlDirectionality(String str, [bool isHtml]) {
391 return estimateDirection(str, isHtml) == TextDirection.RTL; 395 return estimateDirection(str, isHtml) == TextDirection.RTL;
392 } 396 }
393 } 397 }
OLDNEW
« no previous file with comments | « lib/i18n/bidi_formatter.dart ('k') | lib/i18n/date_format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698