OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef DocumentMarkerList_h | |
6 #define DocumentMarkerList_h | |
7 | |
8 #include "core/editing/markers/DocumentMarker.h" | |
9 #include "platform/heap/Handle.h" | |
10 | |
11 namespace blink { | |
12 | |
13 class CORE_EXPORT DocumentMarkerList | |
14 : public GarbageCollected<DocumentMarkerList> { | |
15 public: | |
16 explicit DocumentMarkerList(); | |
17 using iterator = Member<DocumentMarker>*; | |
18 using const_iterator = const Member<DocumentMarker>*; | |
19 | |
20 virtual DocumentMarker::MarkerType allowedMarkerType() const = 0; | |
21 virtual bool isEditingMarkerList() const; | |
22 virtual bool isSpellCheckMarkerList() const; | |
23 | |
24 size_t size() const { return m_markers.size(); } | |
25 bool empty() const { return m_markers.isEmpty(); } | |
26 DocumentMarker* at(size_t index) { return m_markers[index].get(); } | |
27 | |
28 virtual void push_back(DocumentMarker*) = 0; | |
Xiaocheng
2017/03/25 00:05:35
Why not have a default implementation that simply
rlanday
2017/03/27 19:51:30
Note: I'm going to change this to add() here per y
| |
29 virtual void clear(); | |
30 | |
31 iterator begin() { return m_markers.begin(); } | |
32 iterator end() { return m_markers.end(); } | |
33 const_iterator begin() const { return m_markers.begin(); } | |
34 const_iterator end() const { return m_markers.end(); } | |
35 | |
36 void appendMarkersToInputList(DocumentMarkerVector* list) const; | |
37 | |
38 bool copyMarkers(unsigned startOffset, | |
Xiaocheng
2017/03/25 00:05:35
|bool| return values can be ambiguous and should b
| |
39 int length, | |
40 DocumentMarkerList* dstList, | |
41 int delta) const; | |
42 void removeMarkers(unsigned startOffset, | |
Xiaocheng
2017/03/25 00:05:35
No need to use |bool*| to return. Just return it d
| |
43 int length, | |
44 bool shouldRemovePartiallyOverlappingMarkers, | |
45 bool* didRemoveMarker); | |
46 bool shiftMarkers(unsigned offset, unsigned oldLength, unsigned newLength); | |
47 | |
48 DECLARE_VIRTUAL_TRACE(); | |
49 | |
50 protected: | |
51 iterator getPosOfFirstMarkerNotEndingBefore(size_t startOffset); | |
52 virtual bool markerListIsSorted() const = 0; | |
53 | |
54 HeapVector<Member<DocumentMarker>> m_markers; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList); | |
57 }; | |
58 | |
59 } // namespace blink | |
60 | |
61 #endif // DocumentMarkerList_h | |
OLD | NEW |