OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/test_runner/SpellCheckClient.h" | 5 #include "content/shell/renderer/test_runner/SpellCheckClient.h" |
6 | 6 |
7 #include "content/shell/renderer/test_runner/MockGrammarCheck.h" | 7 #include "content/shell/renderer/test_runner/MockGrammarCheck.h" |
8 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 8 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
9 #include "content/shell/renderer/test_runner/WebTestProxy.h" | 9 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
10 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" | 10 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" |
11 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" | 11 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" |
12 | 12 |
13 using namespace blink; | 13 using namespace blink; |
14 using namespace std; | 14 using namespace std; |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 m_spellcheck.fillSuggestionList(WebString(text.substr(misspelledPosi
tion, misspelledLength)), &suggestions); | 121 m_spellcheck.fillSuggestionList(WebString(text.substr(misspelledPosi
tion, misspelledLength)), &suggestions); |
122 results.push_back(WebTextCheckingResult(WebTextDecorationTypeSpellin
g, offset + misspelledPosition, misspelledLength, suggestions.isEmpty() ? WebStr
ing() : suggestions[0])); | 122 results.push_back(WebTextCheckingResult(WebTextDecorationTypeSpellin
g, offset + misspelledPosition, misspelledLength, suggestions.isEmpty() ? WebStr
ing() : suggestions[0])); |
123 text = text.substr(misspelledPosition + misspelledLength); | 123 text = text.substr(misspelledPosition + misspelledLength); |
124 offset += misspelledPosition + misspelledLength; | 124 offset += misspelledPosition + misspelledLength; |
125 } | 125 } |
126 MockGrammarCheck::checkGrammarOfString(m_lastRequestedTextCheckString, &
results); | 126 MockGrammarCheck::checkGrammarOfString(m_lastRequestedTextCheckString, &
results); |
127 } | 127 } |
128 m_lastRequestedTextCheckingCompletion->didFinishCheckingText(results); | 128 m_lastRequestedTextCheckingCompletion->didFinishCheckingText(results); |
129 m_lastRequestedTextCheckingCompletion = 0; | 129 m_lastRequestedTextCheckingCompletion = 0; |
130 | 130 |
131 m_webTestProxy->postSpellCheckEvent(WebString("finishLastTextCheck")); | 131 m_webTestProxy->PostSpellCheckEvent(WebString("finishLastTextCheck")); |
132 } | 132 } |
133 | 133 |
134 WebString SpellCheckClient::autoCorrectWord(const WebString&) | 134 WebString SpellCheckClient::autoCorrectWord(const WebString&) |
135 { | 135 { |
136 // Returns an empty string as Mac WebKit ('WebKitSupport/WebEditorClient.mm'
) | 136 // Returns an empty string as Mac WebKit ('WebKitSupport/WebEditorClient.mm'
) |
137 // does. (If this function returns a non-empty string, WebKit replaces the | 137 // does. (If this function returns a non-empty string, WebKit replaces the |
138 // given misspelled string with the result one. This process executes some | 138 // given misspelled string with the result one. This process executes some |
139 // editor commands and causes layout-test failures.) | 139 // editor commands and causes layout-test failures.) |
140 return WebString(); | 140 return WebString(); |
141 } | 141 } |
142 | 142 |
143 } // namespace content | 143 } // namespace content |
OLD | NEW |