OLD | NEW |
---|---|
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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
795 | 795 |
796 void SpellChecker::didEndEditingOnTextField(Element* e) { | 796 void SpellChecker::didEndEditingOnTextField(Element* e) { |
797 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField"); | 797 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField"); |
798 | 798 |
799 // Remove markers when deactivating a selection in an <input type="text"/>. | 799 // Remove markers when deactivating a selection in an <input type="text"/>. |
800 // Prevent new ones from appearing too. | 800 // Prevent new ones from appearing too. |
801 if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) | 801 if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) |
802 m_spellCheckRequester->cancelCheck(); | 802 m_spellCheckRequester->cancelCheck(); |
803 TextControlElement* textControlElement = toTextControlElement(e); | 803 TextControlElement* textControlElement = toTextControlElement(e); |
804 HTMLElement* innerEditor = textControlElement->innerEditorElement(); | 804 HTMLElement* innerEditor = textControlElement->innerEditorElement(); |
805 removeSpellingAndGrammarMarkers(*innerEditor); | |
806 } | |
807 | |
808 void SpellChecker::removeSpellingAndGrammarMarkers(HTMLElement& element) { | |
yosin_UTC9
2017/01/26 04:55:48
Note: We want to make this function to have |const
| |
805 DocumentMarker::MarkerTypes markerTypes(DocumentMarker::Spelling); | 809 DocumentMarker::MarkerTypes markerTypes(DocumentMarker::Spelling); |
806 markerTypes.add(DocumentMarker::Grammar); | 810 markerTypes.add(DocumentMarker::Grammar); |
807 for (Node& node : NodeTraversal::inclusiveDescendantsOf(*innerEditor)) | 811 for (Node& node : NodeTraversal::inclusiveDescendantsOf(element)) |
Xiaocheng
2017/01/26 05:12:33
This function still removes all markers from the e
yosin_UTC9
2017/01/26 05:44:02
Let me cancel my "lgtm". We need to support follow
Manuel Rego
2017/01/27 12:56:19
True, sorry about that. I was checking only one th
| |
808 frame().document()->markers().removeMarkers(&node, markerTypes); | 812 frame().document()->markers().removeMarkers(&node, markerTypes); |
809 } | 813 } |
810 | 814 |
811 void SpellChecker::replaceMisspelledRange(const String& text) { | 815 void SpellChecker::replaceMisspelledRange(const String& text) { |
812 EphemeralRange caretRange = | 816 EphemeralRange caretRange = |
813 frame().selection().selection().toNormalizedEphemeralRange(); | 817 frame().selection().selection().toNormalizedEphemeralRange(); |
814 if (caretRange.isNull()) | 818 if (caretRange.isNull()) |
815 return; | 819 return; |
816 DocumentMarkerVector markers = frame().document()->markers().markersInRange( | 820 DocumentMarkerVector markers = frame().document()->markers().markersInRange( |
817 caretRange, DocumentMarker::MisspellingMarkers()); | 821 caretRange, DocumentMarker::MisspellingMarkers()); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1167 startOfNextParagraph(createVisiblePosition(paragraphEnd)); | 1171 startOfNextParagraph(createVisiblePosition(paragraphEnd)); |
1168 paragraphStart = newParagraphStart.toParentAnchoredPosition(); | 1172 paragraphStart = newParagraphStart.toParentAnchoredPosition(); |
1169 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); | 1173 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); |
1170 firstIteration = false; | 1174 firstIteration = false; |
1171 totalLengthProcessed += currentLength; | 1175 totalLengthProcessed += currentLength; |
1172 } | 1176 } |
1173 return std::make_pair(firstFoundItem, firstFoundOffset); | 1177 return std::make_pair(firstFoundItem, firstFoundOffset); |
1174 } | 1178 } |
1175 | 1179 |
1176 } // namespace blink | 1180 } // namespace blink |
OLD | NEW |