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 DocumentMarkerController; |
| 14 |
| 15 class DocumentMarkerList : public GarbageCollected<DocumentMarkerList> { |
| 16 WTF_MAKE_NONCOPYABLE(DocumentMarkerList); |
| 17 |
| 18 public: |
| 19 explicit DocumentMarkerList(DocumentMarkerController*); |
| 20 using iterator = Member<DocumentMarker>*; |
| 21 using const_iterator = const Member<DocumentMarker>*; |
| 22 |
| 23 virtual DocumentMarker::MarkerType allowedMarkerType() const = 0; |
| 24 |
| 25 virtual size_t size() const = 0; |
| 26 virtual bool empty() const = 0; |
| 27 virtual DocumentMarker* at(size_t index) = 0; |
| 28 |
| 29 virtual void clear() = 0; |
| 30 |
| 31 virtual iterator begin() = 0; |
| 32 virtual iterator end() = 0; |
| 33 virtual const_iterator begin() const = 0; |
| 34 virtual const_iterator end() const = 0; |
| 35 |
| 36 virtual void appendMarkersToInputList(DocumentMarkerVector* list) const = 0; |
| 37 virtual bool copyMarkers(unsigned startOffset, |
| 38 int length, |
| 39 Node* dstNode, |
| 40 int delta) const = 0; |
| 41 virtual void removeMarkers(unsigned startOffset, |
| 42 int length, |
| 43 bool shouldRemovePartiallyOverlappingMarkers, |
| 44 bool* didRemoveMarker) = 0; |
| 45 virtual bool shiftMarkers(int startOffset, int delta) = 0; |
| 46 |
| 47 DECLARE_VIRTUAL_TRACE(); |
| 48 |
| 49 protected: |
| 50 struct ShiftMarkerResult { |
| 51 unsigned newStartOffset; |
| 52 unsigned newEndOffset; |
| 53 }; |
| 54 |
| 55 static bool startsAfter(const Member<DocumentMarker>&, size_t startOffset); |
| 56 static bool endsBefore(size_t startOffset, const Member<DocumentMarker>& rhv); |
| 57 static bool compareByStart(const Member<DocumentMarker>& lhv, |
| 58 const Member<DocumentMarker>& rhv); |
| 59 |
| 60 ShiftMarkerResult getShiftedMarkerPosition(const DocumentMarker&, |
| 61 unsigned startOffset, |
| 62 int delta); |
| 63 |
| 64 Member<DocumentMarkerController> m_documentMarkerController; |
| 65 }; |
| 66 |
| 67 } // namespace blink |
| 68 |
| 69 #endif // DocumentMarkerList_h |
OLD | NEW |