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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 m_frame.document()->markers().removeMarkers(DocumentMarker::Spelling); | 817 m_frame.document()->markers().removeMarkers(DocumentMarker::Spelling); |
818 if (!isContinuousGrammarCheckingEnabled) | 818 if (!isContinuousGrammarCheckingEnabled) |
819 m_frame.document()->markers().removeMarkers(DocumentMarker::Grammar); | 819 m_frame.document()->markers().removeMarkers(DocumentMarker::Grammar); |
820 } | 820 } |
821 | 821 |
822 void SpellChecker::removeSpellingMarkers() | 822 void SpellChecker::removeSpellingMarkers() |
823 { | 823 { |
824 m_frame.document()->markers().removeMarkers(DocumentMarker::MisspellingMarke rs()); | 824 m_frame.document()->markers().removeMarkers(DocumentMarker::MisspellingMarke rs()); |
825 } | 825 } |
826 | 826 |
827 void SpellChecker::removeSpellingMarkersUnderWords(const Vector<String> &words) | |
828 { | |
groby-ooo-7-16
2014/07/30 21:13:27
You might want to test this for large documents. I
Klemen Forstnerič
2014/07/31 17:14:00
Could you point out which piece of code was shown
groby-ooo-7-16
2014/08/01 00:13:22
The bottleneck for checking was the IPC traffic. Y
Klemen Forstnerič
2014/08/01 21:58:17
Seems to work fast enough. :-)
| |
829 auto document = m_frame.document(); | |
830 auto& markerController = document->markers(); | |
831 | |
832 auto markerNodePairs = markerController.markerNodePairs(); | |
833 for (const auto &markerNodePair: markerNodePairs) { | |
834 auto node = const_cast<Node *>(markerNodePair.first.get()); | |
835 auto marker = markerNodePair.second; | |
836 | |
837 auto markerRange = Range::create(*document, | |
838 node, marker->startOffset(), | |
839 node, marker->endOffset()); | |
840 | |
841 if (words.contains(markerRange->text())) | |
842 markerController.removeMarkers(markerRange.get()); | |
843 } | |
844 | |
845 markerController.repaintMarkers(); | |
846 } | |
847 | |
827 void SpellChecker::spellCheckAfterBlur() | 848 void SpellChecker::spellCheckAfterBlur() |
828 { | 849 { |
829 if (!m_frame.selection().selection().isContentEditable()) | 850 if (!m_frame.selection().selection().isContentEditable()) |
830 return; | 851 return; |
831 | 852 |
832 if (isSelectionInTextField(m_frame.selection().selection())) { | 853 if (isSelectionInTextField(m_frame.selection().selection())) { |
833 // textFieldDidEndEditing() and textFieldDidBeginEditing() handle this. | 854 // textFieldDidEndEditing() and textFieldDidBeginEditing() handle this. |
834 return; | 855 return; |
835 } | 856 } |
836 | 857 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
918 } | 939 } |
919 | 940 |
920 void SpellChecker::requestTextChecking(const Element& element) | 941 void SpellChecker::requestTextChecking(const Element& element) |
921 { | 942 { |
922 RefPtrWillBeRawPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element* >(&element)); | 943 RefPtrWillBeRawPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element* >(&element)); |
923 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck)); | 944 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck)); |
924 } | 945 } |
925 | 946 |
926 | 947 |
927 } // namespace blink | 948 } // namespace blink |
OLD | NEW |