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

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

Issue 2432173005: Get rid of VisibleSelection::selectionFromContentsOfNode() (Closed)
Patch Set: 2016-10-20T17:14:18 Created 4 years, 2 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return; 210 return;
211 isTextField = isHTMLInputElement(*textControl) && 211 isTextField = isHTMLInputElement(*textControl) &&
212 toHTMLInputElement(*textControl).isTextField(); 212 toHTMLInputElement(*textControl).isTextField();
213 } 213 }
214 214
215 if (isTextField || !parent->isAlreadySpellChecked()) { 215 if (isTextField || !parent->isAlreadySpellChecked()) {
216 if (EditingStrategy::editingIgnoresContent(element)) 216 if (EditingStrategy::editingIgnoresContent(element))
217 return; 217 return;
218 // We always recheck textfields because markers are removed from them on 218 // We always recheck textfields because markers are removed from them on
219 // blur. 219 // blur.
220 VisibleSelection selection = 220 const VisibleSelection selection = createVisibleSelection(
221 VisibleSelection::selectionFromContentsOfNode(element); 221 SelectionInDOMTree::Builder().selectAllChildren(*element).build());
222 markMisspellingsAndBadGrammar(selection); 222 markMisspellingsAndBadGrammar(selection);
223 if (!isTextField) 223 if (!isTextField)
224 parent->setAlreadySpellChecked(true); 224 parent->setAlreadySpellChecked(true);
225 } 225 }
226 } 226 }
227 227
228 void SpellChecker::ignoreSpelling() { 228 void SpellChecker::ignoreSpelling() {
229 removeMarkers(frame().selection().selection(), DocumentMarker::Spelling); 229 removeMarkers(frame().selection().selection(), DocumentMarker::Spelling);
230 } 230 }
231 231
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 startOfNextParagraph(createVisiblePosition(paragraphEnd)); 1128 startOfNextParagraph(createVisiblePosition(paragraphEnd));
1129 paragraphStart = newParagraphStart.toParentAnchoredPosition(); 1129 paragraphStart = newParagraphStart.toParentAnchoredPosition();
1130 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); 1130 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition();
1131 firstIteration = false; 1131 firstIteration = false;
1132 totalLengthProcessed += currentLength; 1132 totalLengthProcessed += currentLength;
1133 } 1133 }
1134 return std::make_pair(firstFoundItem, firstFoundOffset); 1134 return std::make_pair(firstFoundItem, firstFoundOffset);
1135 } 1135 }
1136 1136
1137 } // namespace blink 1137 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698