| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 519 |
| 520 // Only mark misspelling if: | 520 // Only mark misspelling if: |
| 521 // 1. Current text checking isn't done for autocorrection, in which
case shouldMarkSpelling is false. | 521 // 1. Current text checking isn't done for autocorrection, in which
case shouldMarkSpelling is false. |
| 522 // 2. Result falls within spellingRange. | 522 // 2. Result falls within spellingRange. |
| 523 // 3. The word in question doesn't end at an ambiguous boundary. For
instance, we would not mark | 523 // 3. The word in question doesn't end at an ambiguous boundary. For
instance, we would not mark |
| 524 // "wouldn'" as misspelled right after apostrophe is typed. | 524 // "wouldn'" as misspelled right after apostrophe is typed. |
| 525 if (shouldMarkSpelling && result->decoration == TextDecorationTypeSp
elling && resultLocation >= paragraph.checkingStart() && resultLocation + result
Length <= spellingRangeEndOffset && !resultEndsAtAmbiguousBoundary) { | 525 if (shouldMarkSpelling && result->decoration == TextDecorationTypeSp
elling && resultLocation >= paragraph.checkingStart() && resultLocation + result
Length <= spellingRangeEndOffset && !resultEndsAtAmbiguousBoundary) { |
| 526 DCHECK_GT(resultLength, 0); | 526 DCHECK_GT(resultLength, 0); |
| 527 DCHECK_GE(resultLocation, 0); | 527 DCHECK_GE(resultLocation, 0); |
| 528 const EphemeralRange misspellingRange = calculateCharacterSubran
ge(paragraph.paragraphRange(), resultLocation, resultLength); | 528 const EphemeralRange misspellingRange = calculateCharacterSubran
ge(paragraph.paragraphRange(), resultLocation, resultLength); |
| 529 frame().document()->markers().addMarker(misspellingRange.startPo
sition(), misspellingRange.endPosition(), DocumentMarker::Spelling, result->repl
acement, result->hash); | 529 frame().document()->markers().addMarker(misspellingRange.startPo
sition(), misspellingRange.endPosition(), DocumentMarker::Spelling, result->repl
acement); |
| 530 } else if (result->decoration == TextDecorationTypeInvisibleSpellche
ck && resultLocation >= paragraph.checkingStart() && resultLocation + resultLeng
th <= spellingRangeEndOffset) { | |
| 531 DCHECK_GT(resultLength, 0); | |
| 532 DCHECK_GE(resultLocation, 0); | |
| 533 const EphemeralRange invisibleSpellcheckRange = calculateCharact
erSubrange(paragraph.paragraphRange(), resultLocation, resultLength); | |
| 534 frame().document()->markers().addMarker(invisibleSpellcheckRange
.startPosition(), invisibleSpellcheckRange.endPosition(), DocumentMarker::Invisi
bleSpellcheck, result->replacement, result->hash); | |
| 535 } | 530 } |
| 536 } | 531 } |
| 537 } | 532 } |
| 538 | 533 |
| 539 if (selectionChanged) { | 534 if (selectionChanged) { |
| 540 TextCheckingParagraph extendedParagraph(paragraph); | 535 TextCheckingParagraph extendedParagraph(paragraph); |
| 541 // Restore the caret position if we have made any replacements | 536 // Restore the caret position if we have made any replacements |
| 542 extendedParagraph.expandRangeToNextEnd(); | 537 extendedParagraph.expandRangeToNextEnd(); |
| 543 if (restoreSelectionAfterChange && selectionOffset >= 0 && selectionOffs
et <= extendedParagraph.rangeLength()) { | 538 if (restoreSelectionAfterChange && selectionOffset >= 0 && selectionOffs
et <= extendedParagraph.rangeLength()) { |
| 544 EphemeralRange selectionRange = extendedParagraph.subrange(0, select
ionOffset); | 539 EphemeralRange selectionRange = extendedParagraph.subrange(0, select
ionOffset); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 visitor->trace(m_frame); | 819 visitor->trace(m_frame); |
| 825 visitor->trace(m_spellCheckRequester); | 820 visitor->trace(m_spellCheckRequester); |
| 826 } | 821 } |
| 827 | 822 |
| 828 void SpellChecker::prepareForLeakDetection() | 823 void SpellChecker::prepareForLeakDetection() |
| 829 { | 824 { |
| 830 m_spellCheckRequester->prepareForLeakDetection(); | 825 m_spellCheckRequester->prepareForLeakDetection(); |
| 831 } | 826 } |
| 832 | 827 |
| 833 } // namespace blink | 828 } // namespace blink |
| OLD | NEW |