| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void toggleSpellCheckingEnabled(); | 62 void toggleSpellCheckingEnabled(); |
| 63 void ignoreSpelling(); | 63 void ignoreSpelling(); |
| 64 bool isSpellCheckingEnabledInFocusedNode() const; | 64 bool isSpellCheckingEnabledInFocusedNode() const; |
| 65 void markMisspellingsAfterApplyingCommand(const CompositeEditCommand&); | 65 void markMisspellingsAfterApplyingCommand(const CompositeEditCommand&); |
| 66 void markAndReplaceFor(SpellCheckRequest*, const Vector<TextCheckingResult>&); | 66 void markAndReplaceFor(SpellCheckRequest*, const Vector<TextCheckingResult>&); |
| 67 void advanceToNextMisspelling(bool startBeforeSelection = false); | 67 void advanceToNextMisspelling(bool startBeforeSelection = false); |
| 68 void showSpellingGuessPanel(); | 68 void showSpellingGuessPanel(); |
| 69 void didBeginEditing(Element*); | 69 void didBeginEditing(Element*); |
| 70 void clearMisspellingsForMovingParagraphs(const VisibleSelection&); | 70 void clearMisspellingsForMovingParagraphs(const VisibleSelection&); |
| 71 void markMisspellingsForMovingParagraphs(const VisibleSelection&); | 71 void markMisspellingsForMovingParagraphs(const VisibleSelection&); |
| 72 void respondToChangedContents(const VisibleSelection&); | |
| 73 void respondToChangedSelection(const Position& oldSelectionStart, | 72 void respondToChangedSelection(const Position& oldSelectionStart, |
| 74 FrameSelection::SetSelectionOptions); | 73 FrameSelection::SetSelectionOptions); |
| 75 void replaceMisspelledRange(const String&); | 74 void replaceMisspelledRange(const String&); |
| 76 void removeSpellingMarkers(); | 75 void removeSpellingMarkers(); |
| 77 void removeSpellingMarkersUnderWords(const Vector<String>& words); | 76 void removeSpellingMarkersUnderWords(const Vector<String>& words); |
| 78 enum class ElementsType { kAll, kOnlyNonEditable }; | 77 enum class ElementsType { kAll, kOnlyNonEditable }; |
| 79 void removeSpellingAndGrammarMarkers(const HTMLElement&, | 78 void removeSpellingAndGrammarMarkers(const HTMLElement&, |
| 80 ElementsType = ElementsType::kAll); | 79 ElementsType = ElementsType::kAll); |
| 81 void spellCheckAfterBlur(); | 80 void spellCheckAfterBlur(); |
| 82 | 81 |
| 83 void didEndEditingOnTextField(Element*); | 82 void didEndEditingOnTextField(Element*); |
| 84 bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, | 83 bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, |
| 85 int from, | 84 int from, |
| 86 int length) const; | 85 int length) const; |
| 87 bool selectionStartHasSpellingMarkerFor(int from, int length) const; | 86 bool selectionStartHasSpellingMarkerFor(int from, int length) const; |
| 88 void updateMarkersForWordsAffectedByEditing( | 87 void updateMarkersForWordsAffectedByEditing( |
| 89 bool onlyHandleWordsContainingSelection); | 88 bool onlyHandleWordsContainingSelection); |
| 90 void cancelCheck(); | 89 void cancelCheck(); |
| 91 | 90 |
| 92 // Exposed for testing and idle time spell checker | 91 // Exposed for testing and idle time spell checker |
| 93 SpellCheckRequester& spellCheckRequester() const { | 92 SpellCheckRequester& spellCheckRequester() const { |
| 94 return *m_spellCheckRequester; | 93 return *m_spellCheckRequester; |
| 95 } | 94 } |
| 96 IdleSpellCheckCallback& idleSpellCheckCallback() const { | |
| 97 return *m_idleSpellCheckCallback; | |
| 98 } | |
| 99 | 95 |
| 100 // The leak detector will report leaks should queued requests be posted | 96 // The leak detector will report leaks should queued requests be posted |
| 101 // while it GCs repeatedly, as the requests keep their associated element | 97 // while it GCs repeatedly, as the requests keep their associated element |
| 102 // alive. | 98 // alive. |
| 103 // | 99 // |
| 104 // Hence allow the leak detector to effectively stop the spell checker to | 100 // Hence allow the leak detector to effectively stop the spell checker to |
| 105 // ensure leak reporting stability. | 101 // ensure leak reporting stability. |
| 106 void prepareForLeakDetection(); | 102 void prepareForLeakDetection(); |
| 107 | 103 |
| 108 void documentAttached(Document*); | |
| 109 | |
| 110 private: | 104 private: |
| 111 explicit SpellChecker(LocalFrame&); | 105 explicit SpellChecker(LocalFrame&); |
| 112 | 106 |
| 113 LocalFrame& frame() const { | 107 LocalFrame& frame() const { |
| 114 DCHECK(m_frame); | 108 DCHECK(m_frame); |
| 115 return *m_frame; | 109 return *m_frame; |
| 116 } | 110 } |
| 117 | 111 |
| 118 // Helper functions for advanceToNextMisspelling() | 112 // Helper functions for advanceToNextMisspelling() |
| 119 Vector<TextCheckingResult> findMisspellings(const String&); | 113 Vector<TextCheckingResult> findMisspellings(const String&); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 135 | 129 |
| 136 Member<LocalFrame> m_frame; | 130 Member<LocalFrame> m_frame; |
| 137 | 131 |
| 138 const Member<SpellCheckRequester> m_spellCheckRequester; | 132 const Member<SpellCheckRequester> m_spellCheckRequester; |
| 139 const Member<IdleSpellCheckCallback> m_idleSpellCheckCallback; | 133 const Member<IdleSpellCheckCallback> m_idleSpellCheckCallback; |
| 140 }; | 134 }; |
| 141 | 135 |
| 142 } // namespace blink | 136 } // namespace blink |
| 143 | 137 |
| 144 #endif // SpellChecker_h | 138 #endif // SpellChecker_h |
| OLD | NEW |