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" |
(...skipping 20 matching lines...) Expand all Loading... |
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 // Returns all markers | 34 // Returns all markers |
35 virtual const HeapVector<Member<DocumentMarker>>& GetMarkers() const = 0; | 35 virtual const HeapVector<Member<DocumentMarker>>& GetMarkers() const = 0; |
36 // Returns the first marker whose interior overlaps with the range | 36 // Returns the first marker whose interior overlaps with the range |
37 // [start_offset, end_offset], or null if there is no such marker. | 37 // [start_offset, end_offset], or null if there is no such marker. |
38 virtual DocumentMarker* FirstMarkerIntersectingRange( | 38 virtual DocumentMarker* FirstMarkerIntersectingRange( |
39 unsigned start_offset, | 39 unsigned start_offset, |
40 unsigned end_offset) const = 0; | 40 unsigned end_offset) const = 0; |
41 // Returns markers that have non-empty overlap with the range | 41 // Returns markers whose interiors have non-empty overlap with the range |
42 // [start_offset, end_offset] | 42 // [start_offset, end_offset]. Note that the range can be collapsed, in which |
| 43 // case markers containing the offset in their interiors are returned. |
43 virtual HeapVector<Member<DocumentMarker>> MarkersIntersectingRange( | 44 virtual HeapVector<Member<DocumentMarker>> MarkersIntersectingRange( |
44 unsigned start_offset, | 45 unsigned start_offset, |
45 unsigned end_offset) const = 0; | 46 unsigned end_offset) const = 0; |
46 | 47 |
47 // Returns true if at least one marker is copied, false otherwise | 48 // Returns true if at least one marker is copied, false otherwise |
48 virtual bool MoveMarkers(int length, DocumentMarkerList* dst_list) = 0; | 49 virtual bool MoveMarkers(int length, DocumentMarkerList* dst_list) = 0; |
49 | 50 |
50 // Returns true if at least one marker is removed, false otherwise | 51 // Returns true if at least one marker is removed, false otherwise |
51 virtual bool RemoveMarkers(unsigned start_offset, int length) = 0; | 52 virtual bool RemoveMarkers(unsigned start_offset, int length) = 0; |
52 | 53 |
53 // Returns true if at least one marker is shifted or removed, false otherwise | 54 // Returns true if at least one marker is shifted or removed, false otherwise |
54 virtual bool ShiftMarkers(unsigned offset, | 55 virtual bool ShiftMarkers(unsigned offset, |
55 unsigned old_length, | 56 unsigned old_length, |
56 unsigned new_length) = 0; | 57 unsigned new_length) = 0; |
57 | 58 |
58 DEFINE_INLINE_VIRTUAL_TRACE() {} | 59 DEFINE_INLINE_VIRTUAL_TRACE() {} |
59 | 60 |
60 protected: | 61 protected: |
61 DocumentMarkerList(); | 62 DocumentMarkerList(); |
62 | 63 |
63 private: | 64 private: |
64 DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList); | 65 DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList); |
65 }; | 66 }; |
66 | 67 |
67 } // namespace blink | 68 } // namespace blink |
68 | 69 |
69 #endif // DocumentMarkerList_h | 70 #endif // DocumentMarkerList_h |
OLD | NEW |