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 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 virtual DocumentMarker* at(size_t index); |
| 27 |
| 28 virtual void add(DocumentMarker*); |
| 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 enum class DidCopyMarkerOrNot { DidNotCopyMarker, DidCopyMarker }; |
| 39 DidCopyMarkerOrNot copyMarkers(unsigned startOffset, |
| 40 int length, |
| 41 DocumentMarkerList* dstList, |
| 42 int delta) const; |
| 43 |
| 44 enum class DidRemoveMarkerOrNot { DidNotRemoveMarker, DidRemoveMarker }; |
| 45 DidRemoveMarkerOrNot removeMarkers( |
| 46 unsigned startOffset, |
| 47 int length, |
| 48 bool shouldRemovePartiallyOverlappingMarkers); |
| 49 |
| 50 enum class DidShiftMarkerOrNot { DidNotShiftMarker, DidShiftMarker }; |
| 51 DidShiftMarkerOrNot shiftMarkers(unsigned offset, |
| 52 unsigned oldLength, |
| 53 unsigned newLength); |
| 54 |
| 55 DECLARE_VIRTUAL_TRACE(); |
| 56 |
| 57 protected: |
| 58 iterator getPosOfFirstMarkerNotEndingBefore(size_t startOffset); |
| 59 virtual bool markerListIsSorted() const = 0; |
| 60 |
| 61 HeapVector<Member<DocumentMarker>> m_markers; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList); |
| 64 }; |
| 65 |
| 66 } // namespace blink |
| 67 |
| 68 #endif // DocumentMarkerList_h |
OLD | NEW |