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

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

Issue 2830213002: [DMC #1.911] Rename DocumentMarkerController::RemoveMarkers() to RemoveMarkersInRange() (Closed)
Patch Set: Remove dependency Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 // Now we remove markers on everything between startOfFirstWord and 756 // Now we remove markers on everything between startOfFirstWord and
757 // endOfLastWord. However, if an autocorrection change a single word to 757 // endOfLastWord. However, if an autocorrection change a single word to
758 // multiple words, we want to remove correction mark from all the resulted 758 // multiple words, we want to remove correction mark from all the resulted
759 // words even we only edit one of them. For example, assuming autocorrection 759 // words even we only edit one of them. For example, assuming autocorrection
760 // changes "avantgarde" to "avant garde", we will have CorrectionIndicator 760 // changes "avantgarde" to "avant garde", we will have CorrectionIndicator
761 // marker on both words and on the whitespace between them. If we then edit 761 // marker on both words and on the whitespace between them. If we then edit
762 // garde, we would like to remove the marker from word "avant" and whitespace 762 // garde, we would like to remove the marker from word "avant" and whitespace
763 // as well. So we need to get the continous range of of marker that contains 763 // as well. So we need to get the continous range of of marker that contains
764 // the word in question, and remove marker on that whole range. 764 // the word in question, and remove marker on that whole range.
765 const EphemeralRange word_range(remove_marker_start, remove_marker_end); 765 const EphemeralRange word_range(remove_marker_start, remove_marker_end);
766 document->Markers().RemoveMarkers(word_range, 766 document->Markers().RemoveMarkersInRange(
767 DocumentMarker::MisspellingMarkers()); 767 word_range, DocumentMarker::MisspellingMarkers());
768 } 768 }
769 769
770 void SpellChecker::DidEndEditingOnTextField(Element* e) { 770 void SpellChecker::DidEndEditingOnTextField(Element* e) {
771 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField"); 771 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField");
772 772
773 // Remove markers when deactivating a selection in an <input type="text"/>. 773 // Remove markers when deactivating a selection in an <input type="text"/>.
774 // Prevent new ones from appearing too. 774 // Prevent new ones from appearing too.
775 if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) 775 if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled())
776 spell_check_requester_->CancelCheck(); 776 spell_check_requester_->CancelCheck();
777 TextControlElement* text_control_element = ToTextControlElement(e); 777 TextControlElement* text_control_element = ToTextControlElement(e);
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 return false; 1025 return false;
1026 } 1026 }
1027 1027
1028 void SpellChecker::RemoveMarkers(const EphemeralRange& range, 1028 void SpellChecker::RemoveMarkers(const EphemeralRange& range,
1029 DocumentMarker::MarkerTypes marker_types) { 1029 DocumentMarker::MarkerTypes marker_types) {
1030 DCHECK(!GetFrame().GetDocument()->NeedsLayoutTreeUpdate()); 1030 DCHECK(!GetFrame().GetDocument()->NeedsLayoutTreeUpdate());
1031 1031
1032 if (range.IsNull()) 1032 if (range.IsNull())
1033 return; 1033 return;
1034 1034
1035 GetFrame().GetDocument()->Markers().RemoveMarkers(range, marker_types); 1035 GetFrame().GetDocument()->Markers().RemoveMarkersInRange(range, marker_types);
1036 } 1036 }
1037 1037
1038 // TODO(xiaochengh): This function is only used by unit tests. We should move it 1038 // TODO(xiaochengh): This function is only used by unit tests. We should move it
1039 // to IdleSpellCheckCallback and modify unit tests to cope with idle time spell 1039 // to IdleSpellCheckCallback and modify unit tests to cope with idle time spell
1040 // checker. 1040 // checker.
1041 void SpellChecker::CancelCheck() { 1041 void SpellChecker::CancelCheck() {
1042 spell_check_requester_->CancelCheck(); 1042 spell_check_requester_->CancelCheck();
1043 } 1043 }
1044 1044
1045 void SpellChecker::DocumentAttached(Document* document) { 1045 void SpellChecker::DocumentAttached(Document* document) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 if (!input.IsFocusedElementInDocument()) 1197 if (!input.IsFocusedElementInDocument())
1198 return false; 1198 return false;
1199 } 1199 }
1200 } 1200 }
1201 HTMLElement* element = 1201 HTMLElement* element =
1202 Traversal<HTMLElement>::FirstAncestorOrSelf(*position.AnchorNode()); 1202 Traversal<HTMLElement>::FirstAncestorOrSelf(*position.AnchorNode());
1203 return element && element->IsSpellCheckingEnabled(); 1203 return element && element->IsSpellCheckingEnabled();
1204 } 1204 }
1205 1205
1206 } // namespace blink 1206 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698