| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/common/l10n_util.h" | 7 #include "chrome/common/l10n_util.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 369 } |
| 370 | 370 |
| 371 #if defined(WCHAR_T_IS_UTF32) | 371 #if defined(WCHAR_T_IS_UTF32) |
| 372 const string16 string_utf16 = WideToUTF16(string); | 372 const string16 string_utf16 = WideToUTF16(string); |
| 373 #else | 373 #else |
| 374 const std::wstring &string_utf16 = string; | 374 const std::wstring &string_utf16 = string; |
| 375 #endif | 375 #endif |
| 376 // Use a line iterator to find the first boundary. | 376 // Use a line iterator to find the first boundary. |
| 377 UErrorCode status = U_ZERO_ERROR; | 377 UErrorCode status = U_ZERO_ERROR; |
| 378 scoped_ptr<RuleBasedBreakIterator> bi(static_cast<RuleBasedBreakIterator*>( | 378 scoped_ptr<RuleBasedBreakIterator> bi(static_cast<RuleBasedBreakIterator*>( |
| 379 RuleBasedBreakIterator::createLineInstance(Locale::getDefault(), status)))
; | 379 RuleBasedBreakIterator::createLineInstance(Locale::getDefault(), |
| 380 status))); |
| 380 if (U_FAILURE(status)) | 381 if (U_FAILURE(status)) |
| 381 return string.substr(0, max) + kElideString; | 382 return string.substr(0, max) + kElideString; |
| 382 bi->setText(string_utf16.c_str()); | 383 bi->setText(string_utf16.c_str()); |
| 383 int32_t index = bi->preceding(static_cast<int32_t>(max)); | 384 int32_t index = bi->preceding(static_cast<int32_t>(max)); |
| 384 if (index == BreakIterator::DONE) { | 385 if (index == BreakIterator::DONE) { |
| 385 index = static_cast<int32_t>(max); | 386 index = static_cast<int32_t>(max); |
| 386 } else { | 387 } else { |
| 387 // Found a valid break (may be the beginning of the string). Now use | 388 // Found a valid break (may be the beginning of the string). Now use |
| 388 // a character iterator to find the previous non-whitespace character. | 389 // a character iterator to find the previous non-whitespace character. |
| 389 StringCharacterIterator char_iterator(string_utf16.c_str()); | 390 StringCharacterIterator char_iterator(string_utf16.c_str()); |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 } | 725 } |
| 725 | 726 |
| 726 void BiDiLineIterator::GetLogicalRun(int start, | 727 void BiDiLineIterator::GetLogicalRun(int start, |
| 727 int* end, | 728 int* end, |
| 728 UBiDiLevel* level) { | 729 UBiDiLevel* level) { |
| 729 DCHECK(bidi_ != NULL); | 730 DCHECK(bidi_ != NULL); |
| 730 ubidi_getLogicalRun(bidi_, start, end, level); | 731 ubidi_getLogicalRun(bidi_, start, end, level); |
| 731 } | 732 } |
| 732 | 733 |
| 733 } | 734 } |
| OLD | NEW |