OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2011 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef TextChecking_h | 31 #ifndef TextChecking_h |
32 #define TextChecking_h | 32 #define TextChecking_h |
33 | 33 |
34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
35 #include "platform/text/TextDecoration.h" | 35 #include "platform/text/TextDecoration.h" |
| 36 #include "wtf/Allocator.h" |
36 #include "wtf/RefCounted.h" | 37 #include "wtf/RefCounted.h" |
37 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
38 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
39 | 40 |
40 namespace blink { | 41 namespace blink { |
41 | 42 |
42 enum TextCheckingType { | 43 enum TextCheckingType { |
43 TextCheckingTypeNone = 0, | 44 TextCheckingTypeNone = 0, |
44 TextCheckingTypeSpelling = 1 << 1, | 45 TextCheckingTypeSpelling = 1 << 1, |
45 TextCheckingTypeGrammar = 1 << 2, | 46 TextCheckingTypeGrammar = 1 << 2, |
46 }; | 47 }; |
47 | 48 |
48 typedef unsigned TextCheckingTypeMask; | 49 typedef unsigned TextCheckingTypeMask; |
49 | 50 |
50 enum TextCheckingProcessType { | 51 enum TextCheckingProcessType { |
51 TextCheckingProcessBatch, | 52 TextCheckingProcessBatch, |
52 TextCheckingProcessIncremental | 53 TextCheckingProcessIncremental |
53 }; | 54 }; |
54 | 55 |
55 struct GrammarDetail { | 56 struct GrammarDetail { |
| 57 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
56 int location; | 58 int location; |
57 int length; | 59 int length; |
58 Vector<String> guesses; | 60 Vector<String> guesses; |
59 String userDescription; | 61 String userDescription; |
60 }; | 62 }; |
61 | 63 |
62 struct TextCheckingResult { | 64 struct TextCheckingResult { |
| 65 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
63 TextDecorationType decoration; | 66 TextDecorationType decoration; |
64 int location; | 67 int location; |
65 int length; | 68 int length; |
66 Vector<GrammarDetail> details; | 69 Vector<GrammarDetail> details; |
67 String replacement; | 70 String replacement; |
68 uint32_t hash; | 71 uint32_t hash; |
69 }; | 72 }; |
70 | 73 |
71 const int unrequestedTextCheckingSequence = -1; | 74 const int unrequestedTextCheckingSequence = -1; |
72 | 75 |
73 class TextCheckingRequestData { | 76 class TextCheckingRequestData final { |
| 77 DISALLOW_NEW(); |
74 friend class SpellCheckRequest; // For access to m_sequence. | 78 friend class SpellCheckRequest; // For access to m_sequence. |
75 public: | 79 public: |
76 TextCheckingRequestData() | 80 TextCheckingRequestData() |
77 : m_sequence(unrequestedTextCheckingSequence) | 81 : m_sequence(unrequestedTextCheckingSequence) |
78 , m_mask(TextCheckingTypeNone) | 82 , m_mask(TextCheckingTypeNone) |
79 , m_processType(TextCheckingProcessIncremental) | 83 , m_processType(TextCheckingProcessIncremental) |
80 { } | 84 { } |
81 TextCheckingRequestData(int sequence, const String& text, TextCheckingTypeMa
sk mask, TextCheckingProcessType processType, const Vector<uint32_t>& markers, c
onst Vector<unsigned>& offsets) | 85 TextCheckingRequestData(int sequence, const String& text, TextCheckingTypeMa
sk mask, TextCheckingProcessType processType, const Vector<uint32_t>& markers, c
onst Vector<unsigned>& offsets) |
82 : m_sequence(sequence) | 86 : m_sequence(sequence) |
83 , m_text(text) | 87 , m_text(text) |
(...skipping 26 matching lines...) Expand all Loading... |
110 DEFINE_INLINE_VIRTUAL_TRACE() { } | 114 DEFINE_INLINE_VIRTUAL_TRACE() { } |
111 | 115 |
112 virtual const TextCheckingRequestData& data() const = 0; | 116 virtual const TextCheckingRequestData& data() const = 0; |
113 virtual void didSucceed(const Vector<TextCheckingResult>&) = 0; | 117 virtual void didSucceed(const Vector<TextCheckingResult>&) = 0; |
114 virtual void didCancel() = 0; | 118 virtual void didCancel() = 0; |
115 }; | 119 }; |
116 | 120 |
117 } | 121 } |
118 | 122 |
119 #endif // TextChecking_h | 123 #endif // TextChecking_h |
OLD | NEW |