| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::WebTextDecorationTypeSpelling, offset + misspelled_position, | 116 blink::WebTextDecorationTypeSpelling, offset + misspelled_position, |
| 117 misspelled_length, | 117 misspelled_length, |
| 118 suggestions.isEmpty() ? blink::WebString() : suggestions[0])); | 118 suggestions.empty() ? blink::WebString() : suggestions[0])); |
| 119 text = text.substr(misspelled_position + misspelled_length); | 119 text = text.substr(misspelled_position + misspelled_length); |
| 120 offset += misspelled_position + misspelled_length; | 120 offset += misspelled_position + misspelled_length; |
| 121 } | 121 } |
| 122 MockGrammarCheck::CheckGrammarOfString(last_requested_text_check_string_, | 122 MockGrammarCheck::CheckGrammarOfString(last_requested_text_check_string_, |
| 123 &results); | 123 &results); |
| 124 } | 124 } |
| 125 last_requested_text_checking_completion_->didFinishCheckingText(results); | 125 last_requested_text_checking_completion_->didFinishCheckingText(results); |
| 126 last_requested_text_checking_completion_ = 0; | 126 last_requested_text_checking_completion_ = 0; |
| 127 RequestResolved(); | 127 RequestResolved(); |
| 128 | 128 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 155 return; | 155 return; |
| 156 | 156 |
| 157 v8::Context::Scope context_scope(context); | 157 v8::Context::Scope context_scope(context); |
| 158 | 158 |
| 159 frame->callFunctionEvenIfScriptDisabled( | 159 frame->callFunctionEvenIfScriptDisabled( |
| 160 v8::Local<v8::Function>::New(isolate, resolved_callback_), | 160 v8::Local<v8::Function>::New(isolate, resolved_callback_), |
| 161 context->Global(), 0, nullptr); | 161 context->Global(), 0, nullptr); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace test_runner | 164 } // namespace test_runner |
| OLD | NEW |