| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (spellingSearchStart == spellingSearchEnd) | 244 if (spellingSearchStart == spellingSearchEnd) |
| 245 return; // nothing to search in | 245 return; // nothing to search in |
| 246 | 246 |
| 247 // We go to the end of our first range instead of the start of it, just to b
e sure | 247 // We go to the end of our first range instead of the start of it, just to b
e sure |
| 248 // we don't get foiled by any word boundary problems at the start. It means
we might | 248 // we don't get foiled by any word boundary problems at the start. It means
we might |
| 249 // do a tiny bit more searching. | 249 // do a tiny bit more searching. |
| 250 Node* searchEndNodeAfterWrap = spellingSearchEnd.computeContainerNode(); | 250 Node* searchEndNodeAfterWrap = spellingSearchEnd.computeContainerNode(); |
| 251 int searchEndOffsetAfterWrap = spellingSearchEnd.offsetInContainerNode(); | 251 int searchEndOffsetAfterWrap = spellingSearchEnd.offsetInContainerNode(); |
| 252 | 252 |
| 253 int misspellingOffset = 0; | 253 int misspellingOffset = 0; |
| 254 String misspelledWord = TextCheckingHelper(spellCheckerClient(), spellingSea
rchStart, spellingSearchEnd).findFirstMisspellingOrBadGrammar(misspellingOffset)
; | 254 String misspelledWord = findFirstMisspellingOrBadGrammar(spellingSearchStart
, spellingSearchEnd, misspellingOffset); |
| 255 | 255 |
| 256 // If we did not find a misspelled word, wrap and try again (but don't bothe
r if we started at the beginning of the | 256 // If we did not find a misspelled word, wrap and try again (but don't bothe
r if we started at the beginning of the |
| 257 // block rather than at a selection). | 257 // block rather than at a selection). |
| 258 if (startedWithSelection && !misspelledWord) { | 258 if (startedWithSelection && !misspelledWord) { |
| 259 spellingSearchStart = Position::editingPositionOf(topNode, 0); | 259 spellingSearchStart = Position::editingPositionOf(topNode, 0); |
| 260 // going until the end of the very first chunk we tested is far enough | 260 // going until the end of the very first chunk we tested is far enough |
| 261 spellingSearchEnd = Position::editingPositionOf(searchEndNodeAfterWrap,
searchEndOffsetAfterWrap); | 261 spellingSearchEnd = Position::editingPositionOf(searchEndNodeAfterWrap,
searchEndOffsetAfterWrap); |
| 262 misspelledWord = TextCheckingHelper(spellCheckerClient(), spellingSearch
Start, spellingSearchEnd).findFirstMisspellingOrBadGrammar(misspellingOffset); | 262 misspelledWord = findFirstMisspellingOrBadGrammar(spellingSearchStart, s
pellingSearchEnd, misspellingOffset); |
| 263 } | 263 } |
| 264 | 264 |
| 265 if (!misspelledWord.isEmpty()) { | 265 if (!misspelledWord.isEmpty()) { |
| 266 // We found a misspelling. Select the misspelling, update the spelling p
anel, and store | 266 // We found a misspelling. Select the misspelling, update the spelling p
anel, and store |
| 267 // a marker so we draw the red squiggle later. | 267 // a marker so we draw the red squiggle later. |
| 268 | 268 |
| 269 const EphemeralRange misspellingRange = calculateCharacterSubrange(Ephem
eralRange(spellingSearchStart, spellingSearchEnd), misspellingOffset, misspelled
Word.length()); | 269 const EphemeralRange misspellingRange = calculateCharacterSubrange(Ephem
eralRange(spellingSearchStart, spellingSearchEnd), misspellingOffset, misspelled
Word.length()); |
| 270 frame().selection().setSelection(VisibleSelection(misspellingRange)); | 270 frame().selection().setSelection(VisibleSelection(misspellingRange)); |
| 271 frame().selection().revealSelection(); | 271 frame().selection().revealSelection(); |
| 272 spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord); | 272 spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord); |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 visitor->trace(m_frame); | 780 visitor->trace(m_frame); |
| 781 visitor->trace(m_spellCheckRequester); | 781 visitor->trace(m_spellCheckRequester); |
| 782 } | 782 } |
| 783 | 783 |
| 784 void SpellChecker::prepareForLeakDetection() | 784 void SpellChecker::prepareForLeakDetection() |
| 785 { | 785 { |
| 786 m_spellCheckRequester->prepareForLeakDetection(); | 786 m_spellCheckRequester->prepareForLeakDetection(); |
| 787 } | 787 } |
| 788 | 788 |
| 789 } // namespace blink | 789 } // namespace blink |
| OLD | NEW |