Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarker.h

Issue 2911733002: [DMC #25] Make DocumentMarker::GetType() virtual (Closed)
Patch Set: Rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 public: 126 public:
127 MisspellingMarkers() : MarkerTypes(kSpelling | kGrammar) {} 127 MisspellingMarkers() : MarkerTypes(kSpelling | kGrammar) {}
128 }; 128 };
129 129
130 DocumentMarker(MarkerType, 130 DocumentMarker(MarkerType,
131 unsigned start_offset, 131 unsigned start_offset,
132 unsigned end_offset, 132 unsigned end_offset,
133 const String& description); 133 const String& description);
134 virtual ~DocumentMarker(); 134 virtual ~DocumentMarker();
135 135
136 MarkerType GetType() const { return type_; } 136 virtual MarkerType GetType() const = 0;
137 unsigned StartOffset() const { return start_offset_; } 137 unsigned StartOffset() const { return start_offset_; }
138 unsigned EndOffset() const { return end_offset_; } 138 unsigned EndOffset() const { return end_offset_; }
139 139
140 struct MarkerOffsets { 140 struct MarkerOffsets {
141 unsigned start_offset; 141 unsigned start_offset;
142 unsigned end_offset; 142 unsigned end_offset;
143 }; 143 };
144 144
145 Optional<MarkerOffsets> ComputeOffsetsAfterShift(unsigned offset, 145 Optional<MarkerOffsets> ComputeOffsetsAfterShift(unsigned offset,
146 unsigned old_length, 146 unsigned old_length,
147 unsigned new_length) const; 147 unsigned new_length) const;
148 148
149 // Offset modifications are done by DocumentMarkerController. 149 // Offset modifications are done by DocumentMarkerController.
150 // Other classes should not call following setters. 150 // Other classes should not call following setters.
151 void SetStartOffset(unsigned offset) { start_offset_ = offset; } 151 void SetStartOffset(unsigned offset) { start_offset_ = offset; }
152 void SetEndOffset(unsigned offset) { end_offset_ = offset; } 152 void SetEndOffset(unsigned offset) { end_offset_ = offset; }
153 void ShiftOffsets(int delta); 153 void ShiftOffsets(int delta);
154 154
155 DEFINE_INLINE_VIRTUAL_TRACE() {} 155 DEFINE_INLINE_VIRTUAL_TRACE() {}
156 156
157 protected: 157 protected:
158 DocumentMarker(MarkerType, unsigned start_offset, unsigned end_offset); 158 DocumentMarker(unsigned start_offset, unsigned end_offset);
159 159
160 private: 160 private:
161 MarkerType type_;
162 unsigned start_offset_; 161 unsigned start_offset_;
163 unsigned end_offset_; 162 unsigned end_offset_;
164 163
165 DISALLOW_COPY_AND_ASSIGN(DocumentMarker); 164 DISALLOW_COPY_AND_ASSIGN(DocumentMarker);
166 }; 165 };
167 166
168 using DocumentMarkerVector = HeapVector<Member<DocumentMarker>>; 167 using DocumentMarkerVector = HeapVector<Member<DocumentMarker>>;
169 168
170 } // namespace blink 169 } // namespace blink
171 170
172 #endif // DocumentMarker_h 171 #endif // DocumentMarker_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698