OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/test_runner/spell_check_client.h" | 5 #include "content/shell/test_runner/spell_check_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 &misspelled_position, &misspelled_length); | 107 &misspelled_position, &misspelled_length); |
108 if (!misspelled_length) | 108 if (!misspelled_length) |
109 break; | 109 break; |
110 blink::WebVector<blink::WebString> suggestions; | 110 blink::WebVector<blink::WebString> suggestions; |
111 spell_check_.FillSuggestionList( | 111 spell_check_.FillSuggestionList( |
112 blink::WebString::FromUTF16( | 112 blink::WebString::FromUTF16( |
113 text.substr(misspelled_position, misspelled_length)), | 113 text.substr(misspelled_position, misspelled_length)), |
114 &suggestions); | 114 &suggestions); |
115 results.push_back(blink::WebTextCheckingResult( | 115 results.push_back(blink::WebTextCheckingResult( |
116 blink::kWebTextDecorationTypeSpelling, offset + misspelled_position, | 116 blink::kWebTextDecorationTypeSpelling, offset + misspelled_position, |
117 misspelled_length, | 117 misspelled_length, suggestions)); |
118 suggestions.IsEmpty() ? blink::WebString() : suggestions[0])); | |
119 text = text.substr(misspelled_position + misspelled_length); | 118 text = text.substr(misspelled_position + misspelled_length); |
120 offset += misspelled_position + misspelled_length; | 119 offset += misspelled_position + misspelled_length; |
121 } | 120 } |
122 MockGrammarCheck::CheckGrammarOfString(last_requested_text_check_string_, | 121 MockGrammarCheck::CheckGrammarOfString(last_requested_text_check_string_, |
123 &results); | 122 &results); |
124 } | 123 } |
125 last_requested_text_checking_completion_->DidFinishCheckingText(results); | 124 last_requested_text_checking_completion_->DidFinishCheckingText(results); |
126 last_requested_text_checking_completion_ = 0; | 125 last_requested_text_checking_completion_ = 0; |
127 RequestResolved(); | 126 RequestResolved(); |
128 | 127 |
(...skipping 26 matching lines...) Expand all Loading... |
155 return; | 154 return; |
156 | 155 |
157 v8::Context::Scope context_scope(context); | 156 v8::Context::Scope context_scope(context); |
158 | 157 |
159 frame->CallFunctionEvenIfScriptDisabled( | 158 frame->CallFunctionEvenIfScriptDisabled( |
160 v8::Local<v8::Function>::New(isolate, resolved_callback_), | 159 v8::Local<v8::Function>::New(isolate, resolved_callback_), |
161 context->Global(), 0, nullptr); | 160 context->Global(), 0, nullptr); |
162 } | 161 } |
163 | 162 |
164 } // namespace test_runner | 163 } // namespace test_runner |
OLD | NEW |