Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/renderer/spellchecker/spellcheck.cc

Issue 10889002: Reset word iterators when changing the spellchecker language. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/renderer/spellchecker/spellcheck_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/renderer/spellchecker/spellcheck.h" 5 #include "chrome/renderer/spellchecker/spellcheck.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 const std::vector<std::string>& custom_words, 122 const std::vector<std::string>& custom_words,
123 const std::string& language) { 123 const std::string& language) {
124 initialized_ = true; 124 initialized_ = true;
125 hunspell_.reset(); 125 hunspell_.reset();
126 bdict_file_.reset(); 126 bdict_file_.reset();
127 file_ = file; 127 file_ = file;
128 is_using_platform_spelling_engine_ = 128 is_using_platform_spelling_engine_ =
129 file == base::kInvalidPlatformFileValue && !language.empty(); 129 file == base::kInvalidPlatformFileValue && !language.empty();
130 130
131 character_attributes_.SetDefaultLanguage(language); 131 character_attributes_.SetDefaultLanguage(language);
132 text_iterator_.Close();
133 contraction_iterator_.Close();
Hajime Morrita 2012/08/28 07:00:34 Nit* It's confusing to call Close() during Init().
Hironori Bono 2012/08/29 08:41:45 Done. I have renamed Close() to Reset().
132 134
133 custom_words_.insert(custom_words_.end(), 135 custom_words_.insert(custom_words_.end(),
134 custom_words.begin(), custom_words.end()); 136 custom_words.begin(), custom_words.end());
135 137
136 // We delay the actual initialization of hunspell until it is needed. 138 // We delay the actual initialization of hunspell until it is needed.
137 } 139 }
138 140
139 bool SpellCheck::SpellCheckWord( 141 bool SpellCheck::SpellCheckWord(
140 const char16* in_word, 142 const char16* in_word,
141 int in_word_len, 143 int in_word_len,
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 516 }
515 } 517 }
516 list[i] = WebKit::WebTextCheckingResult(type, 518 list[i] = WebKit::WebTextCheckingResult(type,
517 word_location + line_offset, 519 word_location + line_offset,
518 word_length, 520 word_length,
519 spellcheck_results[i].replacement); 521 spellcheck_results[i].replacement);
520 } 522 }
521 textcheck_results->swap(list); 523 textcheck_results->swap(list);
522 } 524 }
523 #endif 525 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/spellchecker/spellcheck_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698