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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 PassRefPtrWillBeRawPtr<Range> subrange(int characterOffset, int characterCou
nt) const; | 46 PassRefPtrWillBeRawPtr<Range> subrange(int characterOffset, int characterCou
nt) const; |
47 int offsetTo(const Position&, ExceptionState&) const; | 47 int offsetTo(const Position&, ExceptionState&) const; |
48 void expandRangeToNextEnd(); | 48 void expandRangeToNextEnd(); |
49 | 49 |
50 const String& text() const; | 50 const String& text() const; |
51 // Why not let clients call these functions on text() themselves? | 51 // Why not let clients call these functions on text() themselves? |
52 String textSubstring(unsigned pos, unsigned len = INT_MAX) const { return te
xt().substring(pos, len); } | 52 String textSubstring(unsigned pos, unsigned len = INT_MAX) const { return te
xt().substring(pos, len); } |
53 UChar textCharAt(int index) const { return text()[static_cast<unsigned>(inde
x)]; } | 53 UChar textCharAt(int index) const { return text()[static_cast<unsigned>(inde
x)]; } |
54 | 54 |
55 bool isEmpty() const; | 55 bool isEmpty() const; |
56 bool isTextEmpty() const { return text().isEmpty(); } | |
57 bool isRangeEmpty() const { return checkingStart() >= checkingEnd(); } | |
58 | 56 |
59 int checkingStart() const; | 57 int checkingStart() const; |
60 int checkingEnd() const; | 58 int checkingEnd() const; |
61 int checkingLength() const; | 59 int checkingLength() const; |
62 | 60 |
63 bool checkingRangeCovers(int location, int length) const { return location <
checkingEnd() && location + length > checkingStart(); } | 61 bool checkingRangeCovers(int location, int length) const { return location <
checkingEnd() && location + length > checkingStart(); } |
64 PassRefPtrWillBeRawPtr<Range> paragraphRange() const; | 62 PassRefPtrWillBeRawPtr<Range> paragraphRange() const; |
65 PassRefPtrWillBeRawPtr<Range> checkingRange() const { return m_checkingRange
; } | 63 PassRefPtrWillBeRawPtr<Range> checkingRange() const { return m_checkingRange
; } |
66 | 64 |
67 private: | 65 private: |
68 void invalidateParagraphRangeValues(); | 66 void invalidateParagraphRangeValues(); |
69 PassRefPtrWillBeRawPtr<Range> offsetAsRange() const; | 67 PassRefPtrWillBeRawPtr<Range> offsetAsRange() const; |
70 | 68 |
| 69 bool isTextEmpty() const { return text().isEmpty(); } |
| 70 bool isRangeEmpty() const { return checkingStart() >= checkingEnd(); } |
| 71 |
71 RefPtrWillBeMember<Range> m_checkingRange; | 72 RefPtrWillBeMember<Range> m_checkingRange; |
72 mutable RefPtrWillBeMember<Range> m_paragraphRange; | 73 mutable RefPtrWillBeMember<Range> m_paragraphRange; |
73 mutable RefPtrWillBeMember<Range> m_offsetAsRange; | 74 mutable RefPtrWillBeMember<Range> m_offsetAsRange; |
74 mutable String m_text; | 75 mutable String m_text; |
75 mutable int m_checkingStart; | 76 mutable int m_checkingStart; |
76 mutable int m_checkingEnd; | 77 mutable int m_checkingEnd; |
77 mutable int m_checkingLength; | 78 mutable int m_checkingLength; |
78 }; | 79 }; |
79 | 80 |
80 class TextCheckingHelper { | 81 class TextCheckingHelper { |
(...skipping 18 matching lines...) Expand all Loading... |
99 bool unifiedTextCheckerEnabled() const; | 100 bool unifiedTextCheckerEnabled() const; |
100 }; | 101 }; |
101 | 102 |
102 void checkTextOfParagraph(TextCheckerClient&, const String&, TextCheckingTypeMas
k, Vector<TextCheckingResult>&); | 103 void checkTextOfParagraph(TextCheckerClient&, const String&, TextCheckingTypeMas
k, Vector<TextCheckingResult>&); |
103 void expandRangeToSentenceBoundary(Range&); | 104 void expandRangeToSentenceBoundary(Range&); |
104 bool unifiedTextCheckerEnabled(const LocalFrame*); | 105 bool unifiedTextCheckerEnabled(const LocalFrame*); |
105 | 106 |
106 } // namespace blink | 107 } // namespace blink |
107 | 108 |
108 #endif // TextCheckingHelper_h | 109 #endif // TextCheckingHelper_h |
OLD | NEW |