Chromium Code Reviews| 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(); | |
|
rlanday
2017/03/31 02:44:04
I don't actually need to define a constructor in D
Xiaocheng
2017/03/31 02:56:19
Do you mean it doesn't take any parameter?
In tha
| |
| 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 // TODO(rlanday): this method leaves pointers to the same DocumentMarkers in | |
| 40 // the source and destination lists (and shifts their offsets if delta != 0), | |
| 41 // this should probably be cleaned up eventually to not do that | |
| 42 DidCopyMarkerOrNot copyMarkers(unsigned startOffset, | |
| 43 int length, | |
| 44 DocumentMarkerList* dstList, | |
| 45 int delta) const; | |
| 46 | |
| 47 enum class DidRemoveMarkerOrNot { DidNotRemoveMarker, DidRemoveMarker }; | |
| 48 DidRemoveMarkerOrNot removeMarkers( | |
| 49 unsigned startOffset, | |
| 50 int length, | |
| 51 bool shouldRemovePartiallyOverlappingMarkers); | |
| 52 | |
| 53 enum class DidShiftMarkerOrNot { DidNotShiftMarker, DidShiftMarker }; | |
| 54 DidShiftMarkerOrNot shiftMarkers(unsigned offset, | |
| 55 unsigned oldLength, | |
| 56 unsigned newLength); | |
| 57 | |
| 58 DECLARE_VIRTUAL_TRACE(); | |
| 59 | |
| 60 protected: | |
| 61 iterator getPosOfFirstMarkerNotEndingBefore(size_t startOffset); | |
| 62 virtual bool markerListIsSorted() const = 0; | |
| 63 | |
| 64 HeapVector<Member<DocumentMarker>> m_markers; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList); | |
| 67 }; | |
| 68 | |
| 69 } // namespace blink | |
| 70 | |
| 71 #endif // DocumentMarkerList_h | |
| OLD | NEW |