| Index: base/i18n/bidi_line_iterator.cc
|
| diff --git a/base/i18n/bidi_line_iterator.cc b/base/i18n/bidi_line_iterator.cc
|
| index 8c81d85ec62d6db1efcfea486f781a1223e00793..80da731ec1901917e7c0f9bfc6e5c96430498fe5 100644
|
| --- a/base/i18n/bidi_line_iterator.cc
|
| +++ b/base/i18n/bidi_line_iterator.cc
|
| @@ -9,6 +9,25 @@
|
| namespace base {
|
| namespace i18n {
|
|
|
| +namespace {
|
| +UBiDiLevel GetParagraphLevelForDirection(TextDirection direction) {
|
| + switch (direction) {
|
| + case UNKNOWN_DIRECTION:
|
| + return UBIDI_DEFAULT_LTR;
|
| + break;
|
| + case RIGHT_TO_LEFT:
|
| + return 1; // Highest RTL level.
|
| + break;
|
| + case LEFT_TO_RIGHT:
|
| + return 0; // Highest LTR level.
|
| + break;
|
| + default:
|
| + NOTREACHED();
|
| + return 0;
|
| + }
|
| +}
|
| +} // namespace
|
| +
|
| BiDiLineIterator::BiDiLineIterator() : bidi_(NULL) {
|
| }
|
|
|
| @@ -19,15 +38,14 @@ BiDiLineIterator::~BiDiLineIterator() {
|
| }
|
| }
|
|
|
| -bool BiDiLineIterator::Open(const string16& text, bool right_to_left) {
|
| +bool BiDiLineIterator::Open(const string16& text, TextDirection direction) {
|
| DCHECK(!bidi_);
|
| UErrorCode error = U_ZERO_ERROR;
|
| bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error);
|
| if (U_FAILURE(error))
|
| return false;
|
| ubidi_setPara(bidi_, text.data(), static_cast<int>(text.length()),
|
| - right_to_left ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR,
|
| - NULL, &error);
|
| + GetParagraphLevelForDirection(direction), NULL, &error);
|
| return (U_SUCCESS(error) == TRUE);
|
| }
|
|
|
|
|