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 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #ifndef DocumentMarker_h | 23 #ifndef DocumentMarker_h |
24 #define DocumentMarker_h | 24 #define DocumentMarker_h |
25 | 25 |
26 #include "core/CoreExport.h" | 26 #include "core/CoreExport.h" |
27 #include "platform/graphics/Color.h" | 27 #include "platform/graphics/Color.h" |
28 #include "platform/heap/Handle.h" | 28 #include "platform/heap/Handle.h" |
| 29 #include "wtf/Optional.h" |
29 #include "wtf/VectorTraits.h" | 30 #include "wtf/VectorTraits.h" |
30 #include "wtf/text/WTFString.h" | 31 #include "wtf/text/WTFString.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 class DocumentMarkerDetails; | 35 class DocumentMarkerDetails; |
35 | 36 |
36 // A range of a node within a document that is "marked", such as the range of a | 37 // A range of a node within a document that is "marked", such as the range of a |
37 // misspelled word. It optionally includes a description that could be displayed | 38 // misspelled word. It optionally includes a description that could be displayed |
38 // in the user interface. It also optionally includes a flag specifying whether | 39 // in the user interface. It also optionally includes a flag specifying whether |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 const String& Description() const; | 158 const String& Description() const; |
158 bool IsActiveMatch() const; | 159 bool IsActiveMatch() const; |
159 Color UnderlineColor() const; | 160 Color UnderlineColor() const; |
160 bool Thick() const; | 161 bool Thick() const; |
161 Color BackgroundColor() const; | 162 Color BackgroundColor() const; |
162 DocumentMarkerDetails* Details() const; | 163 DocumentMarkerDetails* Details() const; |
163 | 164 |
164 void SetIsActiveMatch(bool); | 165 void SetIsActiveMatch(bool); |
165 void ClearDetails() { details_.Clear(); } | 166 void ClearDetails() { details_.Clear(); } |
166 | 167 |
| 168 struct MarkerOffsets { |
| 169 unsigned start_offset; |
| 170 unsigned end_offset; |
| 171 }; |
| 172 |
| 173 Optional<MarkerOffsets> ComputeOffsetsAfterShift(unsigned offset, |
| 174 unsigned old_length, |
| 175 unsigned new_length) const; |
| 176 |
167 // Offset modifications are done by DocumentMarkerController. | 177 // Offset modifications are done by DocumentMarkerController. |
168 // Other classes should not call following setters. | 178 // Other classes should not call following setters. |
169 void SetStartOffset(unsigned offset) { start_offset_ = offset; } | 179 void SetStartOffset(unsigned offset) { start_offset_ = offset; } |
170 void SetEndOffset(unsigned offset) { end_offset_ = offset; } | 180 void SetEndOffset(unsigned offset) { end_offset_ = offset; } |
171 void ShiftOffsets(int delta); | 181 void ShiftOffsets(int delta); |
172 | 182 |
173 bool operator==(const DocumentMarker& o) const { | 183 bool operator==(const DocumentMarker& o) const { |
174 return GetType() == o.GetType() && StartOffset() == o.StartOffset() && | 184 return GetType() == o.GetType() && StartOffset() == o.StartOffset() && |
175 EndOffset() == o.EndOffset(); | 185 EndOffset() == o.EndOffset(); |
176 } | 186 } |
(...skipping 23 matching lines...) Expand all Loading... |
200 virtual bool IsDescription() const { return false; } | 210 virtual bool IsDescription() const { return false; } |
201 virtual bool IsTextMatch() const { return false; } | 211 virtual bool IsTextMatch() const { return false; } |
202 virtual bool IsComposition() const { return false; } | 212 virtual bool IsComposition() const { return false; } |
203 | 213 |
204 DEFINE_INLINE_VIRTUAL_TRACE() {} | 214 DEFINE_INLINE_VIRTUAL_TRACE() {} |
205 }; | 215 }; |
206 | 216 |
207 } // namespace blink | 217 } // namespace blink |
208 | 218 |
209 #endif // DocumentMarker_h | 219 #endif // DocumentMarker_h |
OLD | NEW |