OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the DOM implementation for WebCore. | 2 * This file is part of the DOM implementation for WebCore. |
3 * | 3 * |
4 * Copyright (C) 2006 Apple Computer, Inc. | 4 * Copyright (C) 2006 Apple Computer, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 AllMarkers() : MarkerTypes((1 << kMarkerTypeIndexesCount) - 1) {} | 122 AllMarkers() : MarkerTypes((1 << kMarkerTypeIndexesCount) - 1) {} |
123 }; | 123 }; |
124 | 124 |
125 class MisspellingMarkers : public MarkerTypes { | 125 class MisspellingMarkers : public MarkerTypes { |
126 public: | 126 public: |
127 MisspellingMarkers() : MarkerTypes(kSpelling | kGrammar) {} | 127 MisspellingMarkers() : MarkerTypes(kSpelling | kGrammar) {} |
128 }; | 128 }; |
129 | 129 |
130 virtual ~DocumentMarker(); | 130 virtual ~DocumentMarker(); |
131 | 131 |
132 MarkerType GetType() const { return type_; } | 132 virtual MarkerType GetType() const = 0; |
133 unsigned StartOffset() const { return start_offset_; } | 133 unsigned StartOffset() const { return start_offset_; } |
134 unsigned EndOffset() const { return end_offset_; } | 134 unsigned EndOffset() const { return end_offset_; } |
135 | 135 |
136 struct MarkerOffsets { | 136 struct MarkerOffsets { |
137 unsigned start_offset; | 137 unsigned start_offset; |
138 unsigned end_offset; | 138 unsigned end_offset; |
139 }; | 139 }; |
140 | 140 |
141 Optional<MarkerOffsets> ComputeOffsetsAfterShift(unsigned offset, | 141 Optional<MarkerOffsets> ComputeOffsetsAfterShift(unsigned offset, |
142 unsigned old_length, | 142 unsigned old_length, |
143 unsigned new_length) const; | 143 unsigned new_length) const; |
144 | 144 |
145 // Offset modifications are done by DocumentMarkerController. | 145 // Offset modifications are done by DocumentMarkerController. |
146 // Other classes should not call following setters. | 146 // Other classes should not call following setters. |
147 void SetStartOffset(unsigned offset) { start_offset_ = offset; } | 147 void SetStartOffset(unsigned offset) { start_offset_ = offset; } |
148 void SetEndOffset(unsigned offset) { end_offset_ = offset; } | 148 void SetEndOffset(unsigned offset) { end_offset_ = offset; } |
149 void ShiftOffsets(int delta); | 149 void ShiftOffsets(int delta); |
150 | 150 |
151 DEFINE_INLINE_VIRTUAL_TRACE() {} | 151 DEFINE_INLINE_VIRTUAL_TRACE() {} |
152 | 152 |
153 protected: | 153 protected: |
154 DocumentMarker(MarkerType, unsigned start_offset, unsigned end_offset); | 154 DocumentMarker(unsigned start_offset, unsigned end_offset); |
155 | 155 |
156 private: | 156 private: |
157 const MarkerType type_; | |
158 unsigned start_offset_; | 157 unsigned start_offset_; |
159 unsigned end_offset_; | 158 unsigned end_offset_; |
160 | 159 |
161 DISALLOW_COPY_AND_ASSIGN(DocumentMarker); | 160 DISALLOW_COPY_AND_ASSIGN(DocumentMarker); |
162 }; | 161 }; |
163 | 162 |
164 using DocumentMarkerVector = HeapVector<Member<DocumentMarker>>; | 163 using DocumentMarkerVector = HeapVector<Member<DocumentMarker>>; |
165 | 164 |
166 } // namespace blink | 165 } // namespace blink |
167 | 166 |
168 #endif // DocumentMarker_h | 167 #endif // DocumentMarker_h |
OLD | NEW |