Chromium Code Reviews| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 void markAndReplaceFor(SpellCheckRequest*, const Vector<TextCheckingResult>& ); | 64 void markAndReplaceFor(SpellCheckRequest*, const Vector<TextCheckingResult>& ); |
| 65 void advanceToNextMisspelling(bool startBeforeSelection = false); | 65 void advanceToNextMisspelling(bool startBeforeSelection = false); |
| 66 void showSpellingGuessPanel(); | 66 void showSpellingGuessPanel(); |
| 67 void didBeginEditing(Element*); | 67 void didBeginEditing(Element*); |
| 68 void clearMisspellingsAndBadGrammar(const VisibleSelection&); | 68 void clearMisspellings(const VisibleSelection&); |
| 69 void markMisspellingsAndBadGrammar(const VisibleSelection&); | 69 void markMisspellings(const VisibleSelection&); |
| 70 void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSe lection::SetSelectionOptions); | 70 void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSe lection::SetSelectionOptions); |
| 71 void replaceMisspelledRange(const String&); | 71 void replaceMisspelledRange(const String&); |
| 72 void removeSpellingMarkers(); | 72 void removeSpellingMarkers(); |
| 73 void removeSpellingMarkersUnderWords(const Vector<String>& words); | 73 void removeSpellingMarkersUnderWords(const Vector<String>& words); |
| 74 void spellCheckAfterBlur(); | 74 void spellCheckAfterBlur(); |
| 75 | 75 |
| 76 void didEndEditingOnTextField(Element*); | 76 void didEndEditingOnTextField(Element*); |
| 77 bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int le ngth) const; | 77 bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int le ngth) const; |
| 78 bool selectionStartHasSpellingMarkerFor(int from, int length) const; | 78 bool selectionStartHasSpellingMarkerFor(int from, int length) const; |
| 79 void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSe lection); | 79 void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSe lection); |
| 80 void cancelCheck(); | 80 void cancelCheck(); |
| 81 void chunkAndMarkAllMisspellingsAndBadGrammar(Node*, const EphemeralRange&); | 81 void chunkAndMarkAllMisspellings(Node*, const EphemeralRange&); |
| 82 void requestTextChecking(const Element&); | 82 void requestTextChecking(const Element&); |
| 83 | 83 |
| 84 // Exposed for testing only | 84 // Exposed for testing only |
| 85 SpellCheckRequester& spellCheckRequester() const { return *m_spellCheckReque ster; } | 85 SpellCheckRequester& spellCheckRequester() const { return *m_spellCheckReque ster; } |
| 86 | 86 |
| 87 // The leak detector will report leaks should queued requests be posted | 87 // The leak detector will report leaks should queued requests be posted |
| 88 // while it GCs repeatedly, as the requests keep their associated element | 88 // while it GCs repeatedly, as the requests keep their associated element |
| 89 // alive. | 89 // alive. |
| 90 // | 90 // |
| 91 // 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 |
| 92 // ensure leak reporting stability. | 92 // ensure leak reporting stability. |
| 93 void prepareForLeakDetection(); | 93 void prepareForLeakDetection(); |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 explicit SpellChecker(LocalFrame&); | 96 explicit SpellChecker(LocalFrame&); |
| 97 | 97 |
| 98 LocalFrame& frame() const | 98 LocalFrame& frame() const |
| 99 { | 99 { |
| 100 DCHECK(m_frame); | 100 DCHECK(m_frame); |
| 101 return *m_frame; | 101 return *m_frame; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void markMisspellings(const VisibleSelection&); | 104 void markMisspellingsWithTextCheckingHelper(const VisibleSelection&); |
|
Xiaocheng
2016/08/02 09:22:54
I wish I could come up with a better name but didn
yosin_UTC9
2016/08/02 09:34:01
Once we remove all grammar checking code, we might
| |
| 105 void markAllMisspellingsInRange(const EphemeralRange& spellingRange); | 105 void markAllMisspellingsInRange(const EphemeralRange& spellingRange); |
| 106 void spellCheckOldSelection(const VisibleSelection& oldSelection, const Visi bleSelection& newAdjacentWords); | 106 void spellCheckOldSelection(const VisibleSelection& oldSelection, const Visi bleSelection& newAdjacentWords); |
| 107 | 107 |
| 108 void removeMarkers(const VisibleSelection&, DocumentMarker::MarkerTypes); | 108 void removeMarkers(const VisibleSelection&, DocumentMarker::MarkerTypes); |
| 109 bool unifiedTextCheckerEnabled() const; | 109 bool unifiedTextCheckerEnabled() const; |
| 110 | 110 |
| 111 void chunkAndMarkAllMisspellings(const TextCheckingParagraph& fullParagraphT oCheck); | 111 void chunkAndMarkAllMisspellings(const TextCheckingParagraph& fullParagraphT oCheck); |
| 112 | 112 |
| 113 Member<LocalFrame> m_frame; | 113 Member<LocalFrame> m_frame; |
| 114 const Member<SpellCheckRequester> m_spellCheckRequester; | 114 const Member<SpellCheckRequester> m_spellCheckRequester; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 } // namespace blink | 117 } // namespace blink |
| 118 | 118 |
| 119 #endif // SpellChecker_h | 119 #endif // SpellChecker_h |
| OLD | NEW |