OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DocumentMarkerList_h | 5 #ifndef DocumentMarkerList_h |
6 #define DocumentMarkerList_h | 6 #define DocumentMarkerList_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/editing/markers/DocumentMarker.h" | 9 #include "core/editing/markers/DocumentMarker.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class RenderedDocumentMarker; | 14 class DocumentMarker; |
15 | 15 |
16 // This is an interface implemented by classes that DocumentMarkerController | 16 // This is an interface implemented by classes that DocumentMarkerController |
17 // uses to store DocumentMarkers. Different implementations can be written | 17 // uses to store DocumentMarkers. Different implementations can be written |
18 // to handle different MarkerTypes (e.g. to provide more optimized handling of | 18 // to handle different MarkerTypes (e.g. to provide more optimized handling of |
19 // MarkerTypes with different insertion/retrieval patterns, or to provide | 19 // MarkerTypes with different insertion/retrieval patterns, or to provide |
20 // different behavior for certain MarkerTypes). | 20 // different behavior for certain MarkerTypes). |
21 class CORE_EXPORT DocumentMarkerList | 21 class CORE_EXPORT DocumentMarkerList |
22 : public GarbageCollectedFinalized<DocumentMarkerList> { | 22 : public GarbageCollectedFinalized<DocumentMarkerList> { |
23 public: | 23 public: |
24 virtual ~DocumentMarkerList(); | 24 virtual ~DocumentMarkerList(); |
25 | 25 |
26 // Returns the single marker type supported by the list implementation. | 26 // Returns the single marker type supported by the list implementation. |
27 virtual DocumentMarker::MarkerType MarkerType() const = 0; | 27 virtual DocumentMarker::MarkerType MarkerType() const = 0; |
28 | 28 |
29 virtual bool IsEmpty() const = 0; | 29 virtual bool IsEmpty() const = 0; |
30 | 30 |
31 virtual void Add(DocumentMarker*) = 0; | 31 virtual void Add(DocumentMarker*) = 0; |
32 virtual void Clear() = 0; | 32 virtual void Clear() = 0; |
33 | 33 |
34 virtual const HeapVector<Member<RenderedDocumentMarker>>& GetMarkers() | 34 virtual const HeapVector<Member<DocumentMarker>>& GetMarkers() const = 0; |
35 const = 0; | |
36 | 35 |
37 // Returns true if at least one marker is copied, false otherwise | 36 // Returns true if at least one marker is copied, false otherwise |
38 virtual bool MoveMarkers(int length, DocumentMarkerList* dst_list) = 0; | 37 virtual bool MoveMarkers(int length, DocumentMarkerList* dst_list) = 0; |
39 | 38 |
40 // Returns true if at least one marker is removed, false otherwise | 39 // Returns true if at least one marker is removed, false otherwise |
41 virtual bool RemoveMarkers(unsigned start_offset, int length) = 0; | 40 virtual bool RemoveMarkers(unsigned start_offset, int length) = 0; |
42 | 41 |
43 // Returns true if at least one marker is shifted or removed, false otherwise | 42 // Returns true if at least one marker is shifted or removed, false otherwise |
44 virtual bool ShiftMarkers(unsigned offset, | 43 virtual bool ShiftMarkers(unsigned offset, |
45 unsigned old_length, | 44 unsigned old_length, |
46 unsigned new_length) = 0; | 45 unsigned new_length) = 0; |
47 | 46 |
48 DEFINE_INLINE_VIRTUAL_TRACE() {} | 47 DEFINE_INLINE_VIRTUAL_TRACE() {} |
49 | 48 |
50 protected: | 49 protected: |
51 DocumentMarkerList(); | 50 DocumentMarkerList(); |
52 | 51 |
53 private: | 52 private: |
54 DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList); | 53 DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList); |
55 }; | 54 }; |
56 | 55 |
57 } // namespace blink | 56 } // namespace blink |
58 | 57 |
59 #endif // DocumentMarkerList_h | 58 #endif // DocumentMarkerList_h |
OLD | NEW |