| 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(); |
| 72 void respondToChangedSelection(const Position& oldSelectionStart, | 73 void respondToChangedSelection(const Position& oldSelectionStart, |
| 73 FrameSelection::SetSelectionOptions); | 74 FrameSelection::SetSelectionOptions); |
| 74 void replaceMisspelledRange(const String&); | 75 void replaceMisspelledRange(const String&); |
| 75 void removeSpellingMarkers(); | 76 void removeSpellingMarkers(); |
| 76 void removeSpellingMarkersUnderWords(const Vector<String>& words); | 77 void removeSpellingMarkersUnderWords(const Vector<String>& words); |
| 77 enum class ElementsType { kAll, kOnlyNonEditable }; | 78 enum class ElementsType { kAll, kOnlyNonEditable }; |
| 78 void removeSpellingAndGrammarMarkers(const HTMLElement&, | 79 void removeSpellingAndGrammarMarkers(const HTMLElement&, |
| 79 ElementsType = ElementsType::kAll); | 80 ElementsType = ElementsType::kAll); |
| 80 void spellCheckAfterBlur(); | 81 void spellCheckAfterBlur(); |
| 81 | 82 |
| 82 void didEndEditingOnTextField(Element*); | 83 void didEndEditingOnTextField(Element*); |
| 83 bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, | 84 bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, |
| 84 int from, | 85 int from, |
| 85 int length) const; | 86 int length) const; |
| 86 bool selectionStartHasSpellingMarkerFor(int from, int length) const; | 87 bool selectionStartHasSpellingMarkerFor(int from, int length) const; |
| 87 void updateMarkersForWordsAffectedByEditing( | 88 void updateMarkersForWordsAffectedByEditing( |
| 88 bool onlyHandleWordsContainingSelection); | 89 bool onlyHandleWordsContainingSelection); |
| 89 void cancelCheck(); | 90 void cancelCheck(); |
| 90 | 91 |
| 91 // Exposed for testing and idle time spell checker | 92 // Exposed for testing and idle time spell checker |
| 92 SpellCheckRequester& spellCheckRequester() const { | 93 SpellCheckRequester& spellCheckRequester() const { |
| 93 return *m_spellCheckRequester; | 94 return *m_spellCheckRequester; |
| 94 } | 95 } |
| 96 IdleSpellCheckCallback& idleSpellCheckCallback() const { |
| 97 return *m_idleSpellCheckCallback; |
| 98 } |
| 95 | 99 |
| 96 // The leak detector will report leaks should queued requests be posted | 100 // The leak detector will report leaks should queued requests be posted |
| 97 // while it GCs repeatedly, as the requests keep their associated element | 101 // while it GCs repeatedly, as the requests keep their associated element |
| 98 // alive. | 102 // alive. |
| 99 // | 103 // |
| 100 // Hence allow the leak detector to effectively stop the spell checker to | 104 // Hence allow the leak detector to effectively stop the spell checker to |
| 101 // ensure leak reporting stability. | 105 // ensure leak reporting stability. |
| 102 void prepareForLeakDetection(); | 106 void prepareForLeakDetection(); |
| 103 | 107 |
| 108 void documentAttached(Document*); |
| 109 |
| 104 private: | 110 private: |
| 105 explicit SpellChecker(LocalFrame&); | 111 explicit SpellChecker(LocalFrame&); |
| 106 | 112 |
| 107 LocalFrame& frame() const { | 113 LocalFrame& frame() const { |
| 108 DCHECK(m_frame); | 114 DCHECK(m_frame); |
| 109 return *m_frame; | 115 return *m_frame; |
| 110 } | 116 } |
| 111 | 117 |
| 112 // Helper functions for advanceToNextMisspelling() | 118 // Helper functions for advanceToNextMisspelling() |
| 113 Vector<TextCheckingResult> findMisspellings(const String&); | 119 Vector<TextCheckingResult> findMisspellings(const String&); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 129 | 135 |
| 130 Member<LocalFrame> m_frame; | 136 Member<LocalFrame> m_frame; |
| 131 | 137 |
| 132 const Member<SpellCheckRequester> m_spellCheckRequester; | 138 const Member<SpellCheckRequester> m_spellCheckRequester; |
| 133 const Member<IdleSpellCheckCallback> m_idleSpellCheckCallback; | 139 const Member<IdleSpellCheckCallback> m_idleSpellCheckCallback; |
| 134 }; | 140 }; |
| 135 | 141 |
| 136 } // namespace blink | 142 } // namespace blink |
| 137 | 143 |
| 138 #endif // SpellChecker_h | 144 #endif // SpellChecker_h |
| OLD | NEW |