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

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

Issue 1285233004: Get rid of a redundant argument DOWNSTREAM from VisiblePosition constructor call sites (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T12:36:19 Rebase Created 5 years, 4 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
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
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 nex t word so we start checking 211 // If spellingSearchRange starts in the middle of a word, advance to the nex t word so we start checking
212 // at a word boundary. Going back by one char and then forward by a word doe s the trick. 212 // at a word boundary. Going back by one char and then forward by a word doe s the trick.
213 if (startedWithSelection) { 213 if (startedWithSelection) {
214 VisiblePosition oneBeforeStart = VisiblePosition(spellingSearchStart, DOWNST REAM).previous(); 214 VisiblePosition oneBeforeStart = VisiblePosition(spellingSearchStart).previo us();
215 if (oneBeforeStart.isNotNull()) 215 if (oneBeforeStart.isNotNull())
216 spellingSearchStart = endOfWord(oneBeforeStart).toParentAnchoredPosi tion(); 216 spellingSearchStart = endOfWord(oneBeforeStart).toParentAnchoredPosi tion();
217 // else we were already at the start of the editable node 217 // else we were already at the start of the editable node
218 } 218 }
219 219
220 if (spellingSearchStart == spellingSearchEnd) 220 if (spellingSearchStart == spellingSearchEnd)
221 return; // nothing to search in 221 return; // nothing to search in
222 222
223 // We go to the end of our first range instead of the start of it, just to b e sure 223 // We go to the end of our first range instead of the start of it, just to b e sure
224 // we don't get foiled by any word boundary problems at the start. It means we might 224 // we don't get foiled by any word boundary problems at the start. It means we might
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 const EphemeralRange badGrammarRange = calculateCharacterSubrange(Epheme ralRange(grammarSearchStart, grammarSearchEnd), grammarPhraseOffset + grammarDet ail.location, grammarDetail.length); 309 const EphemeralRange badGrammarRange = calculateCharacterSubrange(Epheme ralRange(grammarSearchStart, grammarSearchEnd), grammarPhraseOffset + grammarDet ail.location, grammarDetail.length);
310 frame().selection().setSelection(VisibleSelection(badGrammarRange)); 310 frame().selection().setSelection(VisibleSelection(badGrammarRange));
311 frame().selection().revealSelection(); 311 frame().selection().revealSelection();
312 312
313 frame().document()->markers().addMarker(badGrammarRange.startPosition(), badGrammarRange.endPosition(), DocumentMarker::Grammar, grammarDetail.userDescr iption); 313 frame().document()->markers().addMarker(badGrammarRange.startPosition(), badGrammarRange.endPosition(), DocumentMarker::Grammar, grammarDetail.userDescr iption);
314 } else if (!misspelledWord.isEmpty()) { 314 } else if (!misspelledWord.isEmpty()) {
315 // We found a misspelling, but not any earlier bad grammar. Select the m isspelling, update the spelling panel, and store 315 // We found a misspelling, but not any earlier bad grammar. Select the m isspelling, update the spelling panel, and store
316 // a marker so we draw the red squiggle later. 316 // a marker so we draw the red squiggle later.
317 317
318 const EphemeralRange misspellingRange = calculateCharacterSubrange(Ephem eralRange(spellingSearchStart, spellingSearchEnd), misspellingOffset, misspelled Word.length()); 318 const EphemeralRange misspellingRange = calculateCharacterSubrange(Ephem eralRange(spellingSearchStart, spellingSearchEnd), misspellingOffset, misspelled Word.length());
319 frame().selection().setSelection(VisibleSelection(misspellingRange, DOWN STREAM)); 319 frame().selection().setSelection(VisibleSelection(misspellingRange));
320 frame().selection().revealSelection(); 320 frame().selection().revealSelection();
321 321
322 spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord); 322 spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord);
323 frame().document()->markers().addMarker(misspellingRange.startPosition() , misspellingRange.endPosition(), DocumentMarker::Spelling); 323 frame().document()->markers().addMarker(misspellingRange.startPosition() , misspellingRange.endPosition(), DocumentMarker::Spelling);
324 } 324 }
325 } 325 }
326 326
327 void SpellChecker::showSpellingGuessPanel() 327 void SpellChecker::showSpellingGuessPanel()
328 { 328 {
329 if (spellCheckerClient().spellingUIIsShowing()) { 329 if (spellCheckerClient().spellingUIIsShowing()) {
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck)); 937 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck));
938 } 938 }
939 939
940 DEFINE_TRACE(SpellChecker) 940 DEFINE_TRACE(SpellChecker)
941 { 941 {
942 visitor->trace(m_frame); 942 visitor->trace(m_frame);
943 visitor->trace(m_spellCheckRequester); 943 visitor->trace(m_spellCheckRequester);
944 } 944 }
945 945
946 } // namespace blink 946 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/iterators/TextIterator.cpp ('k') | Source/core/html/HTMLTextFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698