Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h |
| diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5defb6d01724b0511f09ac2b69ad70d2458bef88 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h |
| @@ -0,0 +1,71 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef DocumentMarkerList_h |
| +#define DocumentMarkerList_h |
| + |
| +#include "core/editing/markers/DocumentMarker.h" |
| +#include "platform/heap/Handle.h" |
| + |
| +namespace blink { |
| + |
| +class CORE_EXPORT DocumentMarkerList |
| + : public GarbageCollected<DocumentMarkerList> { |
| + public: |
| + 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
|
| + using iterator = Member<DocumentMarker>*; |
| + using const_iterator = const Member<DocumentMarker>*; |
| + |
| + virtual DocumentMarker::MarkerType allowedMarkerType() const = 0; |
| + virtual bool isEditingMarkerList() const; |
| + virtual bool isSpellCheckMarkerList() const; |
| + |
| + size_t size() const { return m_markers.size(); } |
| + bool empty() const { return m_markers.isEmpty(); } |
| + virtual DocumentMarker* at(size_t index); |
| + |
| + virtual void add(DocumentMarker*); |
| + virtual void clear(); |
| + |
| + iterator begin() { return m_markers.begin(); } |
| + iterator end() { return m_markers.end(); } |
| + const_iterator begin() const { return m_markers.begin(); } |
| + const_iterator end() const { return m_markers.end(); } |
| + |
| + void appendMarkersToInputList(DocumentMarkerVector* list) const; |
| + |
| + enum class DidCopyMarkerOrNot { DidNotCopyMarker, DidCopyMarker }; |
| + // TODO(rlanday): this method leaves pointers to the same DocumentMarkers in |
| + // the source and destination lists (and shifts their offsets if delta != 0), |
| + // this should probably be cleaned up eventually to not do that |
| + DidCopyMarkerOrNot copyMarkers(unsigned startOffset, |
| + int length, |
| + DocumentMarkerList* dstList, |
| + int delta) const; |
| + |
| + enum class DidRemoveMarkerOrNot { DidNotRemoveMarker, DidRemoveMarker }; |
| + DidRemoveMarkerOrNot removeMarkers( |
| + unsigned startOffset, |
| + int length, |
| + bool shouldRemovePartiallyOverlappingMarkers); |
| + |
| + enum class DidShiftMarkerOrNot { DidNotShiftMarker, DidShiftMarker }; |
| + DidShiftMarkerOrNot shiftMarkers(unsigned offset, |
| + unsigned oldLength, |
| + unsigned newLength); |
| + |
| + DECLARE_VIRTUAL_TRACE(); |
| + |
| + protected: |
| + iterator getPosOfFirstMarkerNotEndingBefore(size_t startOffset); |
| + virtual bool markerListIsSorted() const = 0; |
| + |
| + HeapVector<Member<DocumentMarker>> m_markers; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList); |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // DocumentMarkerList_h |