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