| OLD | NEW |
| 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 /** | 5 /** |
| 6 * Bidi stands for Bi-directional text. | 6 * Bidi stands for Bi-directional text. |
| 7 * According to [Wikipedia](http://en.wikipedia.org/wiki/Bi-directional_text): | 7 * According to [Wikipedia](http://en.wikipedia.org/wiki/Bi-directional_text): |
| 8 * Bi-directional text is text containing text in both text directionalities, | 8 * 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 | 9 * 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, | 10 * containing different types of alphabets, but may also refer to boustrophedon, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 * does not depend on the combination of directionalities. | 70 * does not depend on the combination of directionalities. |
| 71 */ | 71 */ |
| 72 BidiFormatter.LTR([alwaysSpan=false]) : contextDirection = TextDirection.LTR, | 72 BidiFormatter.LTR([alwaysSpan=false]) : contextDirection = TextDirection.LTR, |
| 73 _alwaysSpan = alwaysSpan; | 73 _alwaysSpan = alwaysSpan; |
| 74 BidiFormatter.RTL([alwaysSpan=false]) : contextDirection = TextDirection.RTL, | 74 BidiFormatter.RTL([alwaysSpan=false]) : contextDirection = TextDirection.RTL, |
| 75 _alwaysSpan = alwaysSpan; | 75 _alwaysSpan = alwaysSpan; |
| 76 BidiFormatter.UNKNOWN([alwaysSpan=false]) : | 76 BidiFormatter.UNKNOWN([alwaysSpan=false]) : |
| 77 contextDirection = TextDirection.UNKNOWN, _alwaysSpan = alwaysSpan; | 77 contextDirection = TextDirection.UNKNOWN, _alwaysSpan = alwaysSpan; |
| 78 | 78 |
| 79 /** Is true if the known context direction for this formatter is RTL. */ | 79 /** Is true if the known context direction for this formatter is RTL. */ |
| 80 bool get isRTL() => contextDirection == TextDirection.RTL; | 80 bool get isRTL => contextDirection == TextDirection.RTL; |
| 81 | 81 |
| 82 /** | 82 /** |
| 83 * Formats a string of a given (or estimated, if not provided) | 83 * Formats a string of a given (or estimated, if not provided) |
| 84 * [direction] for use in HTML output of the context directionality, so | 84 * [direction] for use in HTML output of the context directionality, so |
| 85 * an opposite-directionality string is neither garbled nor garbles what | 85 * an opposite-directionality string is neither garbled nor garbles what |
| 86 * follows it. | 86 * follows it. |
| 87 * If the input string's directionality doesn't match the context | 87 * If the input string's directionality doesn't match the context |
| 88 * directionality, we wrap it with a `span` tag and add a `dir` attribute | 88 * directionality, we wrap it with a `span` tag and add a `dir` attribute |
| 89 * (either "dir=rtl" or "dir=ltr"). | 89 * (either "dir=rtl" or "dir=ltr"). |
| 90 * If alwaysSpan was true when constructing the formatter, the input is always | 90 * If alwaysSpan was true when constructing the formatter, the input is always |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (contextDirection == TextDirection.LTR) { | 171 if (contextDirection == TextDirection.LTR) { |
| 172 return LRM; | 172 return LRM; |
| 173 } else { | 173 } else { |
| 174 return RLM; | 174 return RLM; |
| 175 } | 175 } |
| 176 } else { | 176 } else { |
| 177 return ''; | 177 return ''; |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 } | 180 } |
| OLD | NEW |