Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: Source/core/editing/SpellChecker.cpp

Issue 420603002: Use tighter typing in editing/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 position = firstEditableVisiblePositionAfterPositionInRoot(position, m_f rame.document()->documentElement()).deepEquivalent(); 194 position = firstEditableVisiblePositionAfterPositionInRoot(position, m_f rame.document()->documentElement()).deepEquivalent();
195 if (position.isNull()) 195 if (position.isNull())
196 return; 196 return;
197 197
198 Position rangeCompliantPosition = position.parentAnchoredEquivalent(); 198 Position rangeCompliantPosition = position.parentAnchoredEquivalent();
199 spellingSearchRange->setStart(rangeCompliantPosition.deprecatedNode(), r angeCompliantPosition.deprecatedEditingOffset(), IGNORE_EXCEPTION); 199 spellingSearchRange->setStart(rangeCompliantPosition.deprecatedNode(), r angeCompliantPosition.deprecatedEditingOffset(), IGNORE_EXCEPTION);
200 startedWithSelection = false; // won't need to wrap 200 startedWithSelection = false; // won't need to wrap
201 } 201 }
202 202
203 // topNode defines the whole range we want to operate on 203 // topNode defines the whole range we want to operate on
204 Node* topNode = highestEditableRoot(position); 204 ContainerNode* topNode = highestEditableRoot(position);
205 // FIXME: lastOffsetForEditing() is wrong here if editingIgnoresContent(high estEditableRoot()) returns true (e.g. a <table>) 205 // FIXME: lastOffsetForEditing() is wrong here if editingIgnoresContent(high estEditableRoot()) returns true (e.g. a <table>)
206 spellingSearchRange->setEnd(topNode, lastOffsetForEditing(topNode), IGNORE_E XCEPTION); 206 spellingSearchRange->setEnd(topNode, lastOffsetForEditing(topNode), IGNORE_E XCEPTION);
207 207
208 // If spellingSearchRange starts in the middle of a word, advance to the nex t word so we start checking 208 // If spellingSearchRange starts in the middle of a word, advance to the nex t word so we start checking
209 // at a word boundary. Going back by one char and then forward by a word doe s the trick. 209 // at a word boundary. Going back by one char and then forward by a word doe s the trick.
210 if (startedWithSelection) { 210 if (startedWithSelection) {
211 VisiblePosition oneBeforeStart = startVisiblePosition(spellingSearchRang e.get(), DOWNSTREAM).previous(); 211 VisiblePosition oneBeforeStart = startVisiblePosition(spellingSearchRang e.get(), DOWNSTREAM).previous();
212 if (oneBeforeStart.isNotNull()) 212 if (oneBeforeStart.isNotNull())
213 setStart(spellingSearchRange.get(), endOfWord(oneBeforeStart)); 213 setStart(spellingSearchRange.get(), endOfWord(oneBeforeStart));
214 // else we were already at the start of the editable node 214 // else we were already at the start of the editable node
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 } 918 }
919 919
920 void SpellChecker::requestTextChecking(const Element& element) 920 void SpellChecker::requestTextChecking(const Element& element)
921 { 921 {
922 RefPtrWillBeRawPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element* >(&element)); 922 RefPtrWillBeRawPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element* >(&element));
923 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck)); 923 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck));
924 } 924 }
925 925
926 926
927 } // namespace blink 927 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/ReplaceSelectionCommand.cpp ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698