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

Side by Side Diff: third_party/WebKit/Source/web/SpellCheckerClientImpl.cpp

Issue 2228293002: Remove dead code in spell checker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DeprecateTextCheckingType
Patch Set: 201608101257 Created 4 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved.
3 * Copyright (C) 2012 Google, Inc. All rights reserved. 3 * Copyright (C) 2012 Google, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 const Vector<unsigned>& markerOffsets = request->data().offsets(); 146 const Vector<unsigned>& markerOffsets = request->data().offsets();
147 m_webView->spellCheckClient()->requestCheckingOfText(text, markers, markerOf fsets, new WebTextCheckingCompletionImpl(request)); 147 m_webView->spellCheckClient()->requestCheckingOfText(text, markers, markerOf fsets, new WebTextCheckingCompletionImpl(request));
148 } 148 }
149 149
150 void SpellCheckerClientImpl::checkGrammarOfString(const String& text, WTF::Vecto r<GrammarDetail>& details, int* badGrammarLocation, int* badGrammarLength) 150 void SpellCheckerClientImpl::checkGrammarOfString(const String& text, WTF::Vecto r<GrammarDetail>& details, int* badGrammarLocation, int* badGrammarLength)
151 { 151 {
152 if (badGrammarLocation) 152 if (badGrammarLocation)
153 *badGrammarLocation = -1; 153 *badGrammarLocation = -1;
154 if (badGrammarLength) 154 if (badGrammarLength)
155 *badGrammarLength = 0; 155 *badGrammarLength = 0;
156 156 return;
157 if (!m_webView->spellCheckClient())
158 return;
159 WebVector<WebTextCheckingResult> webResults;
160 m_webView->spellCheckClient()->checkTextOfParagraph(text, WebTextCheckingTyp eGrammar, &webResults);
161 if (!webResults.size())
162 return;
163
164 // Convert a list of WebTextCheckingResults to a list of GrammarDetails. If
165 // the converted vector of GrammarDetails has grammar errors, we set
166 // badGrammarLocation and badGrammarLength to tell WebKit that the input
167 // text has grammar errors.
168 for (size_t i = 0; i < webResults.size(); ++i) {
169 if (webResults[i].decoration == WebTextDecorationTypeGrammar) {
170 GrammarDetail detail;
171 detail.location = webResults[i].location;
172 detail.length = webResults[i].length;
173 detail.userDescription = webResults[i].replacement;
174 details.append(detail);
175 }
176 }
177 if (!details.size())
178 return;
179 if (badGrammarLocation)
180 *badGrammarLocation = 0;
181 if (badGrammarLength)
182 *badGrammarLength = text.length();
183 } 157 }
184 158
185 void SpellCheckerClientImpl::updateSpellingUIWithMisspelledWord(const String& mi sspelledWord) 159 void SpellCheckerClientImpl::updateSpellingUIWithMisspelledWord(const String& mi sspelledWord)
186 { 160 {
187 if (m_webView->spellCheckClient()) 161 if (m_webView->spellCheckClient())
188 m_webView->spellCheckClient()->updateSpellingUIWithMisspelledWord(WebStr ing(misspelledWord)); 162 m_webView->spellCheckClient()->updateSpellingUIWithMisspelledWord(WebStr ing(misspelledWord));
189 } 163 }
190 164
191 void SpellCheckerClientImpl::showSpellingUI(bool show) 165 void SpellCheckerClientImpl::showSpellingUI(bool show)
192 { 166 {
193 if (m_webView->spellCheckClient()) 167 if (m_webView->spellCheckClient())
194 m_webView->spellCheckClient()->showSpellingUI(show); 168 m_webView->spellCheckClient()->showSpellingUI(show);
195 } 169 }
196 170
197 bool SpellCheckerClientImpl::spellingUIIsShowing() 171 bool SpellCheckerClientImpl::spellingUIIsShowing()
198 { 172 {
199 if (m_webView->spellCheckClient()) 173 if (m_webView->spellCheckClient())
200 return m_webView->spellCheckClient()->isShowingSpellingUI(); 174 return m_webView->spellCheckClient()->isShowingSpellingUI();
201 return false; 175 return false;
202 } 176 }
203 177
204 } // namespace blink 178 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698