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

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

Issue 2723663002: Refactor DocumentMarkerController (Closed)
Patch Set: Created 3 years, 9 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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 m_idleSpellCheckCallback->setNeedsInvocation(); 976 m_idleSpellCheckCallback->setNeedsInvocation();
977 } 977 }
978 978
979 void SpellChecker::removeSpellingMarkers() { 979 void SpellChecker::removeSpellingMarkers() {
980 frame().document()->markers().removeMarkers( 980 frame().document()->markers().removeMarkers(
981 DocumentMarker::MisspellingMarkers()); 981 DocumentMarker::MisspellingMarkers());
982 } 982 }
983 983
984 void SpellChecker::removeSpellingMarkersUnderWords( 984 void SpellChecker::removeSpellingMarkersUnderWords(
985 const Vector<String>& words) { 985 const Vector<String>& words) {
986 MarkerRemoverPredicate removerPredicate(words);
987
988 DocumentMarkerController& markerController = frame().document()->markers(); 986 DocumentMarkerController& markerController = frame().document()->markers();
989 markerController.removeMarkers(removerPredicate); 987 markerController.removeSpellingMarkersForWords(words);
990 markerController.repaintMarkers(); 988 markerController.repaintMarkers();
991 } 989 }
992 990
993 void SpellChecker::spellCheckAfterBlur() { 991 void SpellChecker::spellCheckAfterBlur() {
994 if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) 992 if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled())
995 return; 993 return;
996 994
997 if (!frame() 995 if (!frame()
998 .selection() 996 .selection()
999 .computeVisibleSelectionInDOMTreeDeprecated() 997 .computeVisibleSelectionInDOMTreeDeprecated()
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 startOfNextParagraph(createVisiblePosition(paragraphEnd)); 1235 startOfNextParagraph(createVisiblePosition(paragraphEnd));
1238 paragraphStart = newParagraphStart.toParentAnchoredPosition(); 1236 paragraphStart = newParagraphStart.toParentAnchoredPosition();
1239 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); 1237 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition();
1240 firstIteration = false; 1238 firstIteration = false;
1241 totalLengthProcessed += currentLength; 1239 totalLengthProcessed += currentLength;
1242 } 1240 }
1243 return std::make_pair(firstFoundItem, firstFoundOffset); 1241 return std::make_pair(firstFoundItem, firstFoundOffset);
1244 } 1242 }
1245 1243
1246 } // namespace blink 1244 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698