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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // topNode defines the whole range we want to operate on | 205 // topNode defines the whole range we want to operate on |
206 ContainerNode* topNode = highestEditableRoot(position); | 206 ContainerNode* topNode = highestEditableRoot(position); |
207 // TODO(yosin): |lastOffsetForEditing()| is wrong here if | 207 // TODO(yosin): |lastOffsetForEditing()| is wrong here if |
208 // |editingIgnoresContent(highestEditableRoot())| returns true, e.g. <table> | 208 // |editingIgnoresContent(highestEditableRoot())| returns true, e.g. <table> |
209 spellingSearchEnd = Position::editingPositionOf(topNode, EditingStrategy::la
stOffsetForEditing(topNode)); | 209 spellingSearchEnd = Position::editingPositionOf(topNode, EditingStrategy::la
stOffsetForEditing(topNode)); |
210 | 210 |
211 // If spellingSearchRange starts in the middle of a word, advance to the | 211 // If spellingSearchRange starts in the middle of a word, advance to the |
212 // next word so we start checking at a word boundary. Going back by one char | 212 // next word so we start checking at a word boundary. Going back by one char |
213 // and then forward by a word does the trick. | 213 // and then forward by a word does the trick. |
214 if (startedWithSelection) { | 214 if (startedWithSelection) { |
215 VisiblePosition oneBeforeStart = previousPositionOf(VisiblePosition(spelling
SearchStart)); | 215 VisiblePosition oneBeforeStart = previousPositionOf(createVisiblePosition(sp
ellingSearchStart)); |
216 if (oneBeforeStart.isNotNull()) | 216 if (oneBeforeStart.isNotNull()) |
217 spellingSearchStart = endOfWord(oneBeforeStart).toParentAnchoredPosi
tion(); | 217 spellingSearchStart = endOfWord(oneBeforeStart).toParentAnchoredPosi
tion(); |
218 // else we were already at the start of the editable node | 218 // else we were already at the start of the editable node |
219 } | 219 } |
220 | 220 |
221 if (spellingSearchStart == spellingSearchEnd) | 221 if (spellingSearchStart == spellingSearchEnd) |
222 return; // nothing to search in | 222 return; // nothing to search in |
223 | 223 |
224 // We go to the end of our first range instead of the start of it, just to b
e sure | 224 // We go to the end of our first range instead of the start of it, just to b
e sure |
225 // we don't get foiled by any word boundary problems at the start. It means
we might | 225 // we don't get foiled by any word boundary problems at the start. It means
we might |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec
kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe
ck, rangeToCheck)); | 938 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec
kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe
ck, rangeToCheck)); |
939 } | 939 } |
940 | 940 |
941 DEFINE_TRACE(SpellChecker) | 941 DEFINE_TRACE(SpellChecker) |
942 { | 942 { |
943 visitor->trace(m_frame); | 943 visitor->trace(m_frame); |
944 visitor->trace(m_spellCheckRequester); | 944 visitor->trace(m_spellCheckRequester); |
945 } | 945 } |
946 | 946 |
947 } // namespace blink | 947 } // namespace blink |
OLD | NEW |