| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Implements a custom word iterator used for our spellchecker. | 5 // Implements a custom word iterator used for our spellchecker. |
| 6 | 6 |
| 7 #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" | 7 #include "chrome/renderer/spellchecker/spellcheck_worditerator.h" |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "unicode/normlzr.h" |
| 13 #include "unicode/schriter.h" |
| 14 #include "unicode/uscript.h" |
| 15 #include "unicode/ulocdata.h" |
| 16 |
| 12 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 13 #include "base/logging.h" | 18 #include "base/logging.h" |
| 14 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 15 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/renderer/spellchecker/spellcheck.h" | 21 #include "chrome/renderer/spellchecker/spellcheck.h" |
| 17 #include "third_party/icu/public/common/unicode/normlzr.h" | |
| 18 #include "third_party/icu/public/common/unicode/schriter.h" | |
| 19 #include "third_party/icu/public/common/unicode/uscript.h" | |
| 20 #include "third_party/icu/public/i18n/unicode/ulocdata.h" | |
| 21 | 22 |
| 22 // SpellcheckCharAttribute implementation: | 23 // SpellcheckCharAttribute implementation: |
| 23 | 24 |
| 24 SpellcheckCharAttribute::SpellcheckCharAttribute() | 25 SpellcheckCharAttribute::SpellcheckCharAttribute() |
| 25 : script_code_(USCRIPT_LATIN) { | 26 : script_code_(USCRIPT_LATIN) { |
| 26 } | 27 } |
| 27 | 28 |
| 28 SpellcheckCharAttribute::~SpellcheckCharAttribute() { | 29 SpellcheckCharAttribute::~SpellcheckCharAttribute() { |
| 29 } | 30 } |
| 30 | 31 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 if (status != U_ZERO_ERROR && status != U_STRING_NOT_TERMINATED_WARNING) | 360 if (status != U_ZERO_ERROR && status != U_STRING_NOT_TERMINATED_WARNING) |
| 360 return false; | 361 return false; |
| 361 | 362 |
| 362 // Copy the normalized text to the output. | 363 // Copy the normalized text to the output. |
| 363 icu::StringCharacterIterator it(output); | 364 icu::StringCharacterIterator it(output); |
| 364 for (UChar c = it.first(); c != icu::CharacterIterator::DONE; c = it.next()) | 365 for (UChar c = it.first(); c != icu::CharacterIterator::DONE; c = it.next()) |
| 365 attribute_->OutputChar(c, output_string); | 366 attribute_->OutputChar(c, output_string); |
| 366 | 367 |
| 367 return !output_string->empty(); | 368 return !output_string->empty(); |
| 368 } | 369 } |
| OLD | NEW |