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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 TextCheckerClient& textChecker() const; | 54 TextCheckerClient& textChecker() const; |
55 | 55 |
56 bool isContinuousSpellCheckingEnabled() const; | 56 bool isContinuousSpellCheckingEnabled() const; |
57 void toggleContinuousSpellChecking(); | 57 void toggleContinuousSpellChecking(); |
58 void ignoreSpelling(); | 58 void ignoreSpelling(); |
59 bool isSpellCheckingEnabledInFocusedNode() const; | 59 bool isSpellCheckingEnabledInFocusedNode() const; |
60 bool isSpellCheckingEnabledFor(Node*) const; | 60 bool isSpellCheckingEnabledFor(Node*) const; |
61 static bool isSpellCheckingEnabledFor(const VisibleSelection&); | 61 static bool isSpellCheckingEnabledFor(const VisibleSelection&); |
62 void markMisspellingsAfterLineBreak(const VisibleSelection& wordSelection); | 62 void markMisspellingsAfterLineBreak(const VisibleSelection& wordSelection); |
63 void markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, con
st VisibleSelection& selectionAfterTyping); | 63 void markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, con
st VisibleSelection& selectionAfterTyping); |
64 bool markMisspellings(const VisibleSelection&); | |
65 void markBadGrammar(const VisibleSelection&); | |
66 void markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection
, const VisibleSelection& grammarSelection); | |
67 void markAndReplaceFor(SpellCheckRequest*, const Vector<TextCheckingResult>&
); | 64 void markAndReplaceFor(SpellCheckRequest*, const Vector<TextCheckingResult>&
); |
68 void markAllMisspellingsAndBadGrammarInRanges(const EphemeralRange& spelling
Range, const EphemeralRange& grammarRange); | |
69 void advanceToNextMisspelling(bool startBeforeSelection = false); | 65 void advanceToNextMisspelling(bool startBeforeSelection = false); |
70 void showSpellingGuessPanel(); | 66 void showSpellingGuessPanel(); |
71 void didBeginEditing(Element*); | 67 void didBeginEditing(Element*); |
72 void clearMisspellingsAndBadGrammar(const VisibleSelection&); | 68 void clearMisspellingsAndBadGrammar(const VisibleSelection&); |
73 void markMisspellingsAndBadGrammar(const VisibleSelection&); | 69 void markMisspellingsAndBadGrammar(const VisibleSelection&); |
74 void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSe
lection::SetSelectionOptions); | 70 void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSe
lection::SetSelectionOptions); |
75 void replaceMisspelledRange(const String&); | 71 void replaceMisspelledRange(const String&); |
76 void removeSpellingMarkers(); | 72 void removeSpellingMarkers(); |
77 void removeSpellingMarkersUnderWords(const Vector<String>& words); | 73 void removeSpellingMarkersUnderWords(const Vector<String>& words); |
78 void spellCheckAfterBlur(); | 74 void spellCheckAfterBlur(); |
79 void spellCheckOldSelection(const VisibleSelection& oldSelection, const Visi
bleSelection& newAdjacentWords); | |
80 | 75 |
81 void didEndEditingOnTextField(Element*); | 76 void didEndEditingOnTextField(Element*); |
82 bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int le
ngth) const; | 77 bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int le
ngth) const; |
83 bool selectionStartHasSpellingMarkerFor(int from, int length) const; | 78 bool selectionStartHasSpellingMarkerFor(int from, int length) const; |
84 void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSe
lection); | 79 void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSe
lection); |
85 void cancelCheck(); | 80 void cancelCheck(); |
86 void chunkAndMarkAllMisspellingsAndBadGrammar(Node*, const EphemeralRange&); | 81 void chunkAndMarkAllMisspellingsAndBadGrammar(Node*, const EphemeralRange&); |
87 void requestTextChecking(const Element&); | 82 void requestTextChecking(const Element&); |
88 | 83 |
89 // Exposed for testing only | 84 // Exposed for testing only |
90 SpellCheckRequester& spellCheckRequester() const { return *m_spellCheckReque
ster; } | 85 SpellCheckRequester& spellCheckRequester() const { return *m_spellCheckReque
ster; } |
91 | 86 |
92 // The leak detector will report leaks should queued requests be posted | 87 // The leak detector will report leaks should queued requests be posted |
93 // while it GCs repeatedly, as the requests keep their associated element | 88 // while it GCs repeatedly, as the requests keep their associated element |
94 // alive. | 89 // alive. |
95 // | 90 // |
96 // Hence allow the leak detector to effectively stop the spell checker to | 91 // Hence allow the leak detector to effectively stop the spell checker to |
97 // ensure leak reporting stability. | 92 // ensure leak reporting stability. |
98 void prepareForLeakDetection(); | 93 void prepareForLeakDetection(); |
99 | 94 |
100 private: | 95 private: |
101 explicit SpellChecker(LocalFrame&); | 96 explicit SpellChecker(LocalFrame&); |
102 | 97 |
103 LocalFrame& frame() const | 98 LocalFrame& frame() const |
104 { | 99 { |
105 DCHECK(m_frame); | 100 DCHECK(m_frame); |
106 return *m_frame; | 101 return *m_frame; |
107 } | 102 } |
108 | 103 |
109 bool markMisspellingsOrBadGrammar(const VisibleSelection&, bool checkSpellin
g); | |
110 | |
111 void removeMarkers(const VisibleSelection&, DocumentMarker::MarkerTypes); | 104 void removeMarkers(const VisibleSelection&, DocumentMarker::MarkerTypes); |
112 bool unifiedTextCheckerEnabled() const; | |
113 | 105 |
114 void chunkAndMarkAllMisspellingsAndBadGrammar(const TextCheckingParagraph& f
ullParagraphToCheck); | 106 void chunkAndMarkAllMisspellingsAndBadGrammar(const TextCheckingParagraph& f
ullParagraphToCheck); |
| 107 void markAllMisspellingsAndBadGrammar(const VisibleSelection& spellingSelect
ion, const VisibleSelection& grammarSelection); |
| 108 void spellCheckOldSelection(const VisibleSelection& oldSelection, const Visi
bleSelection& newAdjacentWords); |
115 | 109 |
116 Member<LocalFrame> m_frame; | 110 Member<LocalFrame> m_frame; |
117 const Member<SpellCheckRequester> m_spellCheckRequester; | 111 const Member<SpellCheckRequester> m_spellCheckRequester; |
118 }; | 112 }; |
119 | 113 |
120 } // namespace blink | 114 } // namespace blink |
121 | 115 |
122 #endif // SpellChecker_h | 116 #endif // SpellChecker_h |
OLD | NEW |