OLD | NEW |
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) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 misspelling.location = start + wordStart + misspellingLocation; | 91 misspelling.location = start + wordStart + misspellingLocation; |
92 misspelling.length = misspellingLength; | 92 misspelling.length = misspellingLength; |
93 misspelling.replacement = client.getAutoCorrectSuggestionForMisspell
edWord(String(text + misspelling.location, misspelling.length)); | 93 misspelling.replacement = client.getAutoCorrectSuggestionForMisspell
edWord(String(text + misspelling.location, misspelling.length)); |
94 results.append(misspelling); | 94 results.append(misspelling); |
95 } | 95 } |
96 | 96 |
97 wordStart = wordEnd; | 97 wordStart = wordEnd; |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 static PassRefPtr<Range> expandToParagraphBoundary(PassRefPtr<Range> range) | 101 static PassRefPtrWillBeRawPtr<Range> expandToParagraphBoundary(PassRefPtrWillBeR
awPtr<Range> range) |
102 { | 102 { |
103 RefPtr<Range> paragraphRange = range->cloneRange(IGNORE_EXCEPTION); | 103 RefPtrWillBeRawPtr<Range> paragraphRange = range->cloneRange(IGNORE_EXCEPTIO
N); |
104 setStart(paragraphRange.get(), startOfParagraph(VisiblePosition(range->start
Position()))); | 104 setStart(paragraphRange.get(), startOfParagraph(VisiblePosition(range->start
Position()))); |
105 setEnd(paragraphRange.get(), endOfParagraph(VisiblePosition(range->endPositi
on()))); | 105 setEnd(paragraphRange.get(), endOfParagraph(VisiblePosition(range->endPositi
on()))); |
106 return paragraphRange; | 106 return paragraphRange; |
107 } | 107 } |
108 | 108 |
109 TextCheckingParagraph::TextCheckingParagraph(PassRefPtr<Range> checkingRange) | 109 TextCheckingParagraph::TextCheckingParagraph(PassRefPtrWillBeRawPtr<Range> check
ingRange) |
110 : m_checkingRange(checkingRange) | 110 : m_checkingRange(checkingRange) |
111 , m_checkingStart(-1) | 111 , m_checkingStart(-1) |
112 , m_checkingEnd(-1) | 112 , m_checkingEnd(-1) |
113 , m_checkingLength(-1) | 113 , m_checkingLength(-1) |
114 { | 114 { |
115 } | 115 } |
116 | 116 |
117 TextCheckingParagraph::TextCheckingParagraph(PassRefPtr<Range> checkingRange, Pa
ssRefPtr<Range> paragraphRange) | 117 TextCheckingParagraph::TextCheckingParagraph(PassRefPtrWillBeRawPtr<Range> check
ingRange, PassRefPtrWillBeRawPtr<Range> paragraphRange) |
118 : m_checkingRange(checkingRange) | 118 : m_checkingRange(checkingRange) |
119 , m_paragraphRange(paragraphRange) | 119 , m_paragraphRange(paragraphRange) |
120 , m_checkingStart(-1) | 120 , m_checkingStart(-1) |
121 , m_checkingEnd(-1) | 121 , m_checkingEnd(-1) |
122 , m_checkingLength(-1) | 122 , m_checkingLength(-1) |
123 { | 123 { |
124 } | 124 } |
125 | 125 |
126 TextCheckingParagraph::~TextCheckingParagraph() | 126 TextCheckingParagraph::~TextCheckingParagraph() |
127 { | 127 { |
(...skipping 12 matching lines...) Expand all Loading... |
140 m_offsetAsRange = nullptr; | 140 m_offsetAsRange = nullptr; |
141 m_text = String(); | 141 m_text = String(); |
142 } | 142 } |
143 | 143 |
144 int TextCheckingParagraph::rangeLength() const | 144 int TextCheckingParagraph::rangeLength() const |
145 { | 145 { |
146 ASSERT(m_checkingRange); | 146 ASSERT(m_checkingRange); |
147 return TextIterator::rangeLength(paragraphRange().get()); | 147 return TextIterator::rangeLength(paragraphRange().get()); |
148 } | 148 } |
149 | 149 |
150 PassRefPtr<Range> TextCheckingParagraph::paragraphRange() const | 150 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::paragraphRange() const |
151 { | 151 { |
152 ASSERT(m_checkingRange); | 152 ASSERT(m_checkingRange); |
153 if (!m_paragraphRange) | 153 if (!m_paragraphRange) |
154 m_paragraphRange = expandToParagraphBoundary(checkingRange()); | 154 m_paragraphRange = expandToParagraphBoundary(checkingRange()); |
155 return m_paragraphRange; | 155 return m_paragraphRange; |
156 } | 156 } |
157 | 157 |
158 PassRefPtr<Range> TextCheckingParagraph::subrange(int characterOffset, int chara
cterCount) const | 158 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::subrange(int characterOffse
t, int characterCount) const |
159 { | 159 { |
160 ASSERT(m_checkingRange); | 160 ASSERT(m_checkingRange); |
161 return TextIterator::subrange(paragraphRange().get(), characterOffset, chara
cterCount); | 161 return TextIterator::subrange(paragraphRange().get(), characterOffset, chara
cterCount); |
162 } | 162 } |
163 | 163 |
164 int TextCheckingParagraph::offsetTo(const Position& position, ExceptionState& ex
ceptionState) const | 164 int TextCheckingParagraph::offsetTo(const Position& position, ExceptionState& ex
ceptionState) const |
165 { | 165 { |
166 ASSERT(m_checkingRange); | 166 ASSERT(m_checkingRange); |
167 RefPtr<Range> range = offsetAsRange()->cloneRange(ASSERT_NO_EXCEPTION); | 167 RefPtrWillBeRawPtr<Range> range = offsetAsRange()->cloneRange(ASSERT_NO_EXCE
PTION); |
168 range->setEnd(position.containerNode(), position.computeOffsetInContainerNod
e(), exceptionState); | 168 range->setEnd(position.containerNode(), position.computeOffsetInContainerNod
e(), exceptionState); |
169 if (exceptionState.hadException()) | 169 if (exceptionState.hadException()) |
170 return 0; | 170 return 0; |
171 return TextIterator::rangeLength(range.get()); | 171 return TextIterator::rangeLength(range.get()); |
172 } | 172 } |
173 | 173 |
174 bool TextCheckingParagraph::isEmpty() const | 174 bool TextCheckingParagraph::isEmpty() const |
175 { | 175 { |
176 // Both predicates should have same result, but we check both just for sure. | 176 // Both predicates should have same result, but we check both just for sure. |
177 // We need to investigate to remove this redundancy. | 177 // We need to investigate to remove this redundancy. |
178 return isRangeEmpty() || isTextEmpty(); | 178 return isRangeEmpty() || isTextEmpty(); |
179 } | 179 } |
180 | 180 |
181 PassRefPtr<Range> TextCheckingParagraph::offsetAsRange() const | 181 PassRefPtrWillBeRawPtr<Range> TextCheckingParagraph::offsetAsRange() const |
182 { | 182 { |
183 ASSERT(m_checkingRange); | 183 ASSERT(m_checkingRange); |
184 if (!m_offsetAsRange) | 184 if (!m_offsetAsRange) |
185 m_offsetAsRange = Range::create(paragraphRange()->startContainer()->docu
ment(), paragraphRange()->startPosition(), checkingRange()->startPosition()); | 185 m_offsetAsRange = Range::create(paragraphRange()->startContainer()->docu
ment(), paragraphRange()->startPosition(), checkingRange()->startPosition()); |
186 | 186 |
187 return m_offsetAsRange; | 187 return m_offsetAsRange; |
188 } | 188 } |
189 | 189 |
190 const String& TextCheckingParagraph::text() const | 190 const String& TextCheckingParagraph::text() const |
191 { | 191 { |
(...skipping 20 matching lines...) Expand all Loading... |
212 } | 212 } |
213 | 213 |
214 int TextCheckingParagraph::checkingLength() const | 214 int TextCheckingParagraph::checkingLength() const |
215 { | 215 { |
216 ASSERT(m_checkingRange); | 216 ASSERT(m_checkingRange); |
217 if (-1 == m_checkingLength) | 217 if (-1 == m_checkingLength) |
218 m_checkingLength = TextIterator::rangeLength(checkingRange().get()); | 218 m_checkingLength = TextIterator::rangeLength(checkingRange().get()); |
219 return m_checkingLength; | 219 return m_checkingLength; |
220 } | 220 } |
221 | 221 |
222 TextCheckingHelper::TextCheckingHelper(SpellCheckerClient& client, PassRefPtr<Ra
nge> range) | 222 TextCheckingHelper::TextCheckingHelper(SpellCheckerClient& client, PassRefPtrWil
lBeRawPtr<Range> range) |
223 : m_client(&client) | 223 : m_client(&client) |
224 , m_range(range) | 224 , m_range(range) |
225 { | 225 { |
226 ASSERT_ARG(m_range, m_range); | 226 ASSERT_ARG(m_range, m_range); |
227 } | 227 } |
228 | 228 |
229 TextCheckingHelper::~TextCheckingHelper() | 229 TextCheckingHelper::~TextCheckingHelper() |
230 { | 230 { |
231 } | 231 } |
232 | 232 |
233 String TextCheckingHelper::findFirstMisspelling(int& firstMisspellingOffset, boo
l markAll, RefPtr<Range>& firstMisspellingRange) | 233 String TextCheckingHelper::findFirstMisspelling(int& firstMisspellingOffset, boo
l markAll, RefPtrWillBeRawPtr<Range>& firstMisspellingRange) |
234 { | 234 { |
235 WordAwareIterator it(m_range.get()); | 235 WordAwareIterator it(m_range.get()); |
236 firstMisspellingOffset = 0; | 236 firstMisspellingOffset = 0; |
237 | 237 |
238 String firstMisspelling; | 238 String firstMisspelling; |
239 int currentChunkOffset = 0; | 239 int currentChunkOffset = 0; |
240 | 240 |
241 while (!it.atEnd()) { | 241 while (!it.atEnd()) { |
242 int length = it.length(); | 242 int length = it.length(); |
243 | 243 |
(...skipping 10 matching lines...) Expand all Loading... |
254 ASSERT(misspellingLength >= 0); | 254 ASSERT(misspellingLength >= 0); |
255 ASSERT(misspellingLocation >= -1); | 255 ASSERT(misspellingLocation >= -1); |
256 ASSERT(!misspellingLength || misspellingLocation >= 0); | 256 ASSERT(!misspellingLength || misspellingLocation >= 0); |
257 ASSERT(misspellingLocation < length); | 257 ASSERT(misspellingLocation < length); |
258 ASSERT(misspellingLength <= length); | 258 ASSERT(misspellingLength <= length); |
259 ASSERT(misspellingLocation + misspellingLength <= length); | 259 ASSERT(misspellingLocation + misspellingLength <= length); |
260 | 260 |
261 if (misspellingLocation >= 0 && misspellingLength > 0 && misspelling
Location < length && misspellingLength <= length && misspellingLocation + misspe
llingLength <= length) { | 261 if (misspellingLocation >= 0 && misspellingLength > 0 && misspelling
Location < length && misspellingLength <= length && misspellingLocation + misspe
llingLength <= length) { |
262 | 262 |
263 // Compute range of misspelled word | 263 // Compute range of misspelled word |
264 RefPtr<Range> misspellingRange = TextIterator::subrange(m_range.
get(), currentChunkOffset + misspellingLocation, misspellingLength); | 264 RefPtrWillBeRawPtr<Range> misspellingRange = TextIterator::subra
nge(m_range.get(), currentChunkOffset + misspellingLocation, misspellingLength); |
265 | 265 |
266 // Remember first-encountered misspelling and its offset. | 266 // Remember first-encountered misspelling and its offset. |
267 if (!firstMisspelling) { | 267 if (!firstMisspelling) { |
268 firstMisspellingOffset = currentChunkOffset + misspellingLoc
ation; | 268 firstMisspellingOffset = currentChunkOffset + misspellingLoc
ation; |
269 firstMisspelling = it.substring(misspellingLocation, misspel
lingLength); | 269 firstMisspelling = it.substring(misspellingLocation, misspel
lingLength); |
270 firstMisspellingRange = misspellingRange; | 270 firstMisspellingRange = misspellingRange; |
271 } | 271 } |
272 | 272 |
273 // Store marker for misspelled word. | 273 // Store marker for misspelled word. |
274 misspellingRange->startContainer()->document().markers().addMark
er(misspellingRange.get(), DocumentMarker::Spelling); | 274 misspellingRange->startContainer()->document().markers().addMark
er(misspellingRange.get(), DocumentMarker::Spelling); |
(...skipping 24 matching lines...) Expand all Loading... |
299 outIsSpelling = true; | 299 outIsSpelling = true; |
300 outFirstFoundOffset = 0; | 300 outFirstFoundOffset = 0; |
301 outGrammarDetail.location = -1; | 301 outGrammarDetail.location = -1; |
302 outGrammarDetail.length = 0; | 302 outGrammarDetail.length = 0; |
303 outGrammarDetail.guesses.clear(); | 303 outGrammarDetail.guesses.clear(); |
304 outGrammarDetail.userDescription = ""; | 304 outGrammarDetail.userDescription = ""; |
305 | 305 |
306 // Expand the search range to encompass entire paragraphs, since text checki
ng needs that much context. | 306 // Expand the search range to encompass entire paragraphs, since text checki
ng needs that much context. |
307 // Determine the character offset from the start of the paragraph to the sta
rt of the original search range, | 307 // Determine the character offset from the start of the paragraph to the sta
rt of the original search range, |
308 // since we will want to ignore results in this area. | 308 // since we will want to ignore results in this area. |
309 RefPtr<Range> paragraphRange = m_range->cloneRange(IGNORE_EXCEPTION); | 309 RefPtrWillBeRawPtr<Range> paragraphRange = m_range->cloneRange(IGNORE_EXCEPT
ION); |
310 setStart(paragraphRange.get(), startOfParagraph(VisiblePosition(m_range->sta
rtPosition()))); | 310 setStart(paragraphRange.get(), startOfParagraph(VisiblePosition(m_range->sta
rtPosition()))); |
311 int totalRangeLength = TextIterator::rangeLength(paragraphRange.get()); | 311 int totalRangeLength = TextIterator::rangeLength(paragraphRange.get()); |
312 setEnd(paragraphRange.get(), endOfParagraph(VisiblePosition(m_range->startPo
sition()))); | 312 setEnd(paragraphRange.get(), endOfParagraph(VisiblePosition(m_range->startPo
sition()))); |
313 | 313 |
314 RefPtr<Range> offsetAsRange = Range::create(paragraphRange->startContainer()
->document(), paragraphRange->startPosition(), m_range->startPosition()); | 314 RefPtrWillBeRawPtr<Range> offsetAsRange = Range::create(paragraphRange->star
tContainer()->document(), paragraphRange->startPosition(), m_range->startPositio
n()); |
315 int rangeStartOffset = TextIterator::rangeLength(offsetAsRange.get()); | 315 int rangeStartOffset = TextIterator::rangeLength(offsetAsRange.get()); |
316 int totalLengthProcessed = 0; | 316 int totalLengthProcessed = 0; |
317 | 317 |
318 bool firstIteration = true; | 318 bool firstIteration = true; |
319 bool lastIteration = false; | 319 bool lastIteration = false; |
320 while (totalLengthProcessed < totalRangeLength) { | 320 while (totalLengthProcessed < totalRangeLength) { |
321 // Iterate through the search range by paragraphs, checking each one for
spelling and grammar. | 321 // Iterate through the search range by paragraphs, checking each one for
spelling and grammar. |
322 int currentLength = TextIterator::rangeLength(paragraphRange.get()); | 322 int currentLength = TextIterator::rangeLength(paragraphRange.get()); |
323 int currentStartOffset = firstIteration ? rangeStartOffset : 0; | 323 int currentStartOffset = firstIteration ? rangeStartOffset : 0; |
324 int currentEndOffset = currentLength; | 324 int currentEndOffset = currentLength; |
325 if (inSameParagraph(VisiblePosition(paragraphRange->startPosition()), Vi
siblePosition(m_range->endPosition()))) { | 325 if (inSameParagraph(VisiblePosition(paragraphRange->startPosition()), Vi
siblePosition(m_range->endPosition()))) { |
326 // Determine the character offset from the end of the original searc
h range to the end of the paragraph, | 326 // Determine the character offset from the end of the original searc
h range to the end of the paragraph, |
327 // since we will want to ignore results in this area. | 327 // since we will want to ignore results in this area. |
328 RefPtr<Range> endOffsetAsRange = Range::create(paragraphRange->start
Container()->document(), paragraphRange->startPosition(), m_range->endPosition()
); | 328 RefPtrWillBeRawPtr<Range> endOffsetAsRange = Range::create(paragraph
Range->startContainer()->document(), paragraphRange->startPosition(), m_range->e
ndPosition()); |
329 currentEndOffset = TextIterator::rangeLength(endOffsetAsRange.get())
; | 329 currentEndOffset = TextIterator::rangeLength(endOffsetAsRange.get())
; |
330 lastIteration = true; | 330 lastIteration = true; |
331 } | 331 } |
332 if (currentStartOffset < currentEndOffset) { | 332 if (currentStartOffset < currentEndOffset) { |
333 String paragraphString = plainText(paragraphRange.get()); | 333 String paragraphString = plainText(paragraphRange.get()); |
334 if (paragraphString.length() > 0) { | 334 if (paragraphString.length() > 0) { |
335 bool foundGrammar = false; | 335 bool foundGrammar = false; |
336 int spellingLocation = 0; | 336 int spellingLocation = 0; |
337 int grammarPhraseLocation = 0; | 337 int grammarPhraseLocation = 0; |
338 int grammarDetailLocation = 0; | 338 int grammarDetailLocation = 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 outGrammarDetail = result->details[grammarDetailInde
x]; | 371 outGrammarDetail = result->details[grammarDetailInde
x]; |
372 badGrammarPhrase = paragraphString.substring(result-
>location, result->length); | 372 badGrammarPhrase = paragraphString.substring(result-
>location, result->length); |
373 ASSERT(badGrammarPhrase.length()); | 373 ASSERT(badGrammarPhrase.length()); |
374 } | 374 } |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 if (!misspelledWord.isEmpty() && (!checkGrammar || badGrammarPhr
ase.isEmpty() || spellingLocation <= grammarDetailLocation)) { | 378 if (!misspelledWord.isEmpty() && (!checkGrammar || badGrammarPhr
ase.isEmpty() || spellingLocation <= grammarDetailLocation)) { |
379 int spellingOffset = spellingLocation - currentStartOffset; | 379 int spellingOffset = spellingLocation - currentStartOffset; |
380 if (!firstIteration) { | 380 if (!firstIteration) { |
381 RefPtr<Range> paragraphOffsetAsRange = Range::create(par
agraphRange->startContainer()->document(), m_range->startPosition(), paragraphRa
nge->startPosition()); | 381 RefPtrWillBeRawPtr<Range> paragraphOffsetAsRange = Range
::create(paragraphRange->startContainer()->document(), m_range->startPosition(),
paragraphRange->startPosition()); |
382 spellingOffset += TextIterator::rangeLength(paragraphOff
setAsRange.get()); | 382 spellingOffset += TextIterator::rangeLength(paragraphOff
setAsRange.get()); |
383 } | 383 } |
384 outIsSpelling = true; | 384 outIsSpelling = true; |
385 outFirstFoundOffset = spellingOffset; | 385 outFirstFoundOffset = spellingOffset; |
386 firstFoundItem = misspelledWord; | 386 firstFoundItem = misspelledWord; |
387 break; | 387 break; |
388 } | 388 } |
389 if (checkGrammar && !badGrammarPhrase.isEmpty()) { | 389 if (checkGrammar && !badGrammarPhrase.isEmpty()) { |
390 int grammarPhraseOffset = grammarPhraseLocation - currentSta
rtOffset; | 390 int grammarPhraseOffset = grammarPhraseLocation - currentSta
rtOffset; |
391 if (!firstIteration) { | 391 if (!firstIteration) { |
392 RefPtr<Range> paragraphOffsetAsRange = Range::create(par
agraphRange->startContainer()->document(), m_range->startPosition(), paragraphRa
nge->startPosition()); | 392 RefPtrWillBeRawPtr<Range> paragraphOffsetAsRange = Range
::create(paragraphRange->startContainer()->document(), m_range->startPosition(),
paragraphRange->startPosition()); |
393 grammarPhraseOffset += TextIterator::rangeLength(paragra
phOffsetAsRange.get()); | 393 grammarPhraseOffset += TextIterator::rangeLength(paragra
phOffsetAsRange.get()); |
394 } | 394 } |
395 outIsSpelling = false; | 395 outIsSpelling = false; |
396 outFirstFoundOffset = grammarPhraseOffset; | 396 outFirstFoundOffset = grammarPhraseOffset; |
397 firstFoundItem = badGrammarPhrase; | 397 firstFoundItem = badGrammarPhrase; |
398 break; | 398 break; |
399 } | 399 } |
400 } | 400 } |
401 } | 401 } |
402 if (lastIteration || totalLengthProcessed + currentLength >= totalRangeL
ength) | 402 if (lastIteration || totalLengthProcessed + currentLength >= totalRangeL
ength) |
(...skipping 21 matching lines...) Expand all Loading... |
424 | 424 |
425 // Skip this detail if it starts before the original search range | 425 // Skip this detail if it starts before the original search range |
426 if (detailStartOffsetInParagraph < startOffset) | 426 if (detailStartOffsetInParagraph < startOffset) |
427 continue; | 427 continue; |
428 | 428 |
429 // Skip this detail if it starts after the original search range | 429 // Skip this detail if it starts after the original search range |
430 if (detailStartOffsetInParagraph >= endOffset) | 430 if (detailStartOffsetInParagraph >= endOffset) |
431 continue; | 431 continue; |
432 | 432 |
433 if (markAll) { | 433 if (markAll) { |
434 RefPtr<Range> badGrammarRange = TextIterator::subrange(m_range.get()
, badGrammarPhraseLocation - startOffset + detail->location, detail->length); | 434 RefPtrWillBeRawPtr<Range> badGrammarRange = TextIterator::subrange(m
_range.get(), badGrammarPhraseLocation - startOffset + detail->location, detail-
>length); |
435 badGrammarRange->startContainer()->document().markers().addMarker(ba
dGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription); | 435 badGrammarRange->startContainer()->document().markers().addMarker(ba
dGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription); |
436 } | 436 } |
437 | 437 |
438 // Remember this detail only if it's earlier than our current candidate
(the details aren't in a guaranteed order) | 438 // Remember this detail only if it's earlier than our current candidate
(the details aren't in a guaranteed order) |
439 if (earliestDetailIndex < 0 || earliestDetailLocationSoFar > detail->loc
ation) { | 439 if (earliestDetailIndex < 0 || earliestDetailLocationSoFar > detail->loc
ation) { |
440 earliestDetailIndex = i; | 440 earliestDetailIndex = i; |
441 earliestDetailLocationSoFar = detail->location; | 441 earliestDetailLocationSoFar = detail->location; |
442 } | 442 } |
443 } | 443 } |
444 | 444 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 } | 497 } |
498 | 498 |
499 // These results were all between the start of the paragraph and the sta
rt of the search range; look | 499 // These results were all between the start of the paragraph and the sta
rt of the search range; look |
500 // beyond this phrase. | 500 // beyond this phrase. |
501 startOffset = badGrammarPhraseLocation + badGrammarPhraseLength; | 501 startOffset = badGrammarPhraseLocation + badGrammarPhraseLength; |
502 } | 502 } |
503 | 503 |
504 return firstBadGrammarPhrase; | 504 return firstBadGrammarPhrase; |
505 } | 505 } |
506 | 506 |
507 void TextCheckingHelper::markAllMisspellings(RefPtr<Range>& firstMisspellingRang
e) | 507 void TextCheckingHelper::markAllMisspellings(RefPtrWillBeRawPtr<Range>& firstMis
spellingRange) |
508 { | 508 { |
509 // Use the "markAll" feature of findFirstMisspelling. Ignore the return valu
e and the "out parameter"; | 509 // Use the "markAll" feature of findFirstMisspelling. Ignore the return valu
e and the "out parameter"; |
510 // all we need to do is mark every instance. | 510 // all we need to do is mark every instance. |
511 int ignoredOffset; | 511 int ignoredOffset; |
512 findFirstMisspelling(ignoredOffset, true, firstMisspellingRange); | 512 findFirstMisspelling(ignoredOffset, true, firstMisspellingRange); |
513 } | 513 } |
514 | 514 |
515 void TextCheckingHelper::markAllBadGrammar() | 515 void TextCheckingHelper::markAllBadGrammar() |
516 { | 516 { |
517 // Use the "markAll" feature of ofindFirstBadGrammar. Ignore the return valu
e and "out parameters"; all we need to | 517 // Use the "markAll" feature of ofindFirstBadGrammar. Ignore the return valu
e and "out parameters"; all we need to |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 return false; | 569 return false; |
570 | 570 |
571 const Settings* settings = frame->settings(); | 571 const Settings* settings = frame->settings(); |
572 if (!settings) | 572 if (!settings) |
573 return false; | 573 return false; |
574 | 574 |
575 return settings->unifiedTextCheckerEnabled(); | 575 return settings->unifiedTextCheckerEnabled(); |
576 } | 576 } |
577 | 577 |
578 } | 578 } |
OLD | NEW |