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 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 bool isEmpty() const; | 51 bool isEmpty() const; |
52 bool isTextEmpty() const { return text().isEmpty(); } | 52 bool isTextEmpty() const { return text().isEmpty(); } |
53 bool isRangeEmpty() const { return checkingStart() >= checkingEnd(); } | 53 bool isRangeEmpty() const { return checkingStart() >= checkingEnd(); } |
54 | 54 |
55 int checkingStart() const; | 55 int checkingStart() const; |
56 int checkingEnd() const; | 56 int checkingEnd() const; |
57 int checkingLength() const; | 57 int checkingLength() const; |
58 String checkingSubstring() const { return textSubstring(checkingStart(), che
ckingLength()); } | 58 String checkingSubstring() const { return textSubstring(checkingStart(), che
ckingLength()); } |
59 | 59 |
60 bool checkingRangeMatches(int location, int length) const { return location
== checkingStart() && length == checkingLength(); } | |
61 bool isCheckingRangeCoveredBy(int location, int length) const { return locat
ion <= checkingStart() && location + length >= checkingStart() + checkingLength(
); } | |
62 bool checkingRangeCovers(int location, int length) const { return location <
checkingEnd() && location + length > checkingStart(); } | 60 bool checkingRangeCovers(int location, int length) const { return location <
checkingEnd() && location + length > checkingStart(); } |
63 PassRefPtr<Range> paragraphRange() const; | 61 PassRefPtr<Range> paragraphRange() const; |
64 | 62 |
65 private: | 63 private: |
66 void invalidateParagraphRangeValues(); | 64 void invalidateParagraphRangeValues(); |
67 PassRefPtr<Range> checkingRange() const { return m_checkingRange; } | 65 PassRefPtr<Range> checkingRange() const { return m_checkingRange; } |
68 PassRefPtr<Range> offsetAsRange() const; | 66 PassRefPtr<Range> offsetAsRange() const; |
69 const String& text() const; | 67 const String& text() const; |
70 | 68 |
71 RefPtr<Range> m_checkingRange; | 69 RefPtr<Range> m_checkingRange; |
(...skipping 11 matching lines...) Expand all Loading... |
83 TextCheckingHelper(EditorClient*, PassRefPtr<Range>); | 81 TextCheckingHelper(EditorClient*, PassRefPtr<Range>); |
84 ~TextCheckingHelper(); | 82 ~TextCheckingHelper(); |
85 | 83 |
86 String findFirstMisspelling(int& firstMisspellingOffset, bool markAll, RefPt
r<Range>& firstMisspellingRange); | 84 String findFirstMisspelling(int& firstMisspellingOffset, bool markAll, RefPt
r<Range>& firstMisspellingRange); |
87 String findFirstMisspellingOrBadGrammar(bool checkGrammar, bool& outIsSpelli
ng, int& outFirstFoundOffset, GrammarDetail& outGrammarDetail); | 85 String findFirstMisspellingOrBadGrammar(bool checkGrammar, bool& outIsSpelli
ng, int& outFirstFoundOffset, GrammarDetail& outGrammarDetail); |
88 String findFirstBadGrammar(GrammarDetail& outGrammarDetail, int& outGrammarP
hraseOffset, bool markAll); | 86 String findFirstBadGrammar(GrammarDetail& outGrammarDetail, int& outGrammarP
hraseOffset, bool markAll); |
89 int findFirstGrammarDetail(const Vector<GrammarDetail>& grammarDetails, int
badGrammarPhraseLocation, int badGrammarPhraseLength, int startOffset, int endOf
fset, bool markAll); | 87 int findFirstGrammarDetail(const Vector<GrammarDetail>& grammarDetails, int
badGrammarPhraseLocation, int badGrammarPhraseLength, int startOffset, int endOf
fset, bool markAll); |
90 void markAllMisspellings(RefPtr<Range>& firstMisspellingRange); | 88 void markAllMisspellings(RefPtr<Range>& firstMisspellingRange); |
91 void markAllBadGrammar(); | 89 void markAllBadGrammar(); |
92 | 90 |
93 bool isUngrammatical(Vector<String>& guessesVector) const; | |
94 Vector<String> guessesForMisspelledOrUngrammaticalRange(bool checkGrammar, b
ool& misspelled, bool& ungrammatical) const; | |
95 private: | 91 private: |
96 EditorClient* m_client; | 92 EditorClient* m_client; |
97 RefPtr<Range> m_range; | 93 RefPtr<Range> m_range; |
98 | 94 |
99 bool unifiedTextCheckerEnabled() const; | 95 bool unifiedTextCheckerEnabled() const; |
100 }; | 96 }; |
101 | 97 |
102 void checkTextOfParagraph(TextCheckerClient*, const UChar* text, int length, | 98 void checkTextOfParagraph(TextCheckerClient*, const UChar* text, int length, |
103 TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results); | 99 TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results); |
104 | 100 |
105 bool unifiedTextCheckerEnabled(const Frame*); | 101 bool unifiedTextCheckerEnabled(const Frame*); |
106 | 102 |
107 } // namespace WebCore | 103 } // namespace WebCore |
108 | 104 |
109 #endif // TextCheckingHelper_h | 105 #endif // TextCheckingHelper_h |
OLD | NEW |