| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 RefPtr<Range> misspellingRange = TextIterator::subrange(m_range.
get(), currentChunkOffset + misspellingLocation, misspellingLength); | 264 RefPtr<Range> misspellingRange = TextIterator::subrange(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()->addMar
ker(misspellingRange.get(), DocumentMarker::Spelling); | 274 misspellingRange->startContainer()->document().markers().addMark
er(misspellingRange.get(), DocumentMarker::Spelling); |
| 275 | 275 |
| 276 // Bail out if we're marking only the first misspelling, and not
all instances. | 276 // Bail out if we're marking only the first misspelling, and not
all instances. |
| 277 if (!markAll) | 277 if (!markAll) |
| 278 break; | 278 break; |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| 282 currentChunkOffset += length; | 282 currentChunkOffset += length; |
| 283 it.advance(); | 283 it.advance(); |
| 284 } | 284 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 RefPtr<Range> badGrammarRange = TextIterator::subrange(m_range.get()
, badGrammarPhraseLocation - startOffset + detail->location, detail->length); |
| 435 badGrammarRange->startContainer()->document().markers()->addMarker(b
adGrammarRange.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 |
| 445 return earliestDetailIndex; | 445 return earliestDetailIndex; |
| (...skipping 123 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 |