OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/renderer/spellchecker/spellcheck.h" | 16 #include "chrome/renderer/spellchecker/spellcheck.h" |
17 #include "third_party/icu/public/common/unicode/normlzr.h" | 17 #include "third_party/icu/source/common/unicode/normlzr.h" |
18 #include "third_party/icu/public/common/unicode/schriter.h" | 18 #include "third_party/icu/source/common/unicode/schriter.h" |
19 #include "third_party/icu/public/common/unicode/uscript.h" | 19 #include "third_party/icu/source/common/unicode/uscript.h" |
20 #include "third_party/icu/public/i18n/unicode/ulocdata.h" | 20 #include "third_party/icu/source/i18n/unicode/ulocdata.h" |
21 | 21 |
22 // SpellcheckCharAttribute implementation: | 22 // SpellcheckCharAttribute implementation: |
23 | 23 |
24 SpellcheckCharAttribute::SpellcheckCharAttribute() | 24 SpellcheckCharAttribute::SpellcheckCharAttribute() |
25 : script_code_(USCRIPT_LATIN) { | 25 : script_code_(USCRIPT_LATIN) { |
26 } | 26 } |
27 | 27 |
28 SpellcheckCharAttribute::~SpellcheckCharAttribute() { | 28 SpellcheckCharAttribute::~SpellcheckCharAttribute() { |
29 } | 29 } |
30 | 30 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 if (status != U_ZERO_ERROR && status != U_STRING_NOT_TERMINATED_WARNING) | 416 if (status != U_ZERO_ERROR && status != U_STRING_NOT_TERMINATED_WARNING) |
417 return false; | 417 return false; |
418 | 418 |
419 // Copy the normalized text to the output. | 419 // Copy the normalized text to the output. |
420 icu::StringCharacterIterator it(output); | 420 icu::StringCharacterIterator it(output); |
421 for (UChar c = it.first(); c != icu::CharacterIterator::DONE; c = it.next()) | 421 for (UChar c = it.first(); c != icu::CharacterIterator::DONE; c = it.next()) |
422 attribute_->OutputChar(c, output_string); | 422 attribute_->OutputChar(c, output_string); |
423 | 423 |
424 return !output_string->empty(); | 424 return !output_string->empty(); |
425 } | 425 } |
OLD | NEW |