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..f4467b51024a6011fd43d38e365bebe387fbc622 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h |
| @@ -0,0 +1,68 @@ |
| +// 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 DocumentMarkerController; |
| + |
| +class CORE_EXPORT DocumentMarkerList |
| + : public GarbageCollected<DocumentMarkerList> { |
| + public: |
| + explicit DocumentMarkerList(DocumentMarkerController*); |
| + 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; |
|
Xiaocheng
2017/03/24 03:57:47
These getters should be inlined for efficiency.
rlanday
2017/03/24 17:45:48
Ok
|
| + bool empty() const; |
| + virtual DocumentMarker* at(size_t index); |
|
Xiaocheng
2017/03/24 03:57:47
I guess this function no longer needs to be virtua
rlanday
2017/03/24 17:45:48
Oh, good catch!
|
| + |
| + virtual void clear() = 0; |
| + |
| + iterator begin(); |
| + iterator end(); |
| + const_iterator begin() const; |
| + const_iterator end() const; |
| + |
| + void appendMarkersToInputList(DocumentMarkerVector* list) const; |
| + |
| + bool copyMarkers(unsigned startOffset, |
| + int length, |
| + Node* dstNode, |
| + int delta) const; |
| + virtual void removeMarkers(unsigned startOffset, |
| + int length, |
| + bool shouldRemovePartiallyOverlappingMarkers, |
| + bool* didRemoveMarker) = 0; |
| + virtual bool shiftMarkers(unsigned offset, |
| + unsigned oldLength, |
| + unsigned newLength) = 0; |
| + |
| + DECLARE_VIRTUAL_TRACE(); |
| + |
| + protected: |
| + HeapVector<Member<DocumentMarker>>::iterator |
|
Xiaocheng
2017/03/24 03:57:47
Is it just |iterator|?
rlanday
2017/03/24 17:45:48
Yep!
|
| + getPosOfFirstMarkerNotEndingBefore(size_t startOffset); |
| + |
| + Member<DocumentMarkerController> m_documentMarkerController; |
| + HeapVector<Member<DocumentMarker>> m_markers; |
| + |
| + private: |
| + static bool endsBefore(size_t startOffset, const Member<DocumentMarker>& rhv); |
|
Xiaocheng
2017/03/24 03:57:47
This should be just a local function hidden in an
rlanday
2017/03/24 17:45:48
Ah ok, I wasn't sure what the rule was, I'll remem
Xiaocheng
2017/03/24 19:43:49
I'm not sure if there's a coding style rule about
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList); |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // DocumentMarkerList_h |