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 TextMatchMarkerListImpl_h | 5 #ifndef TextMatchMarkerListImpl_h |
6 #define TextMatchMarkerListImpl_h | 6 #define TextMatchMarkerListImpl_h |
7 | 7 |
8 #include "core/editing/markers/DocumentMarkerList.h" | 8 #include "core/editing/markers/DocumentMarkerList.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
| 12 class IntRect; |
| 13 |
12 // Implementation of DocumentMarkerList for TextMatch markers. | 14 // Implementation of DocumentMarkerList for TextMatch markers. |
13 // Markers are kept sorted by start offset, under the assumption that | 15 // Markers are kept sorted by start offset, under the assumption that |
14 // TextMatch markers are typically inserted in an order. | 16 // TextMatch markers are typically inserted in an order. |
15 class CORE_EXPORT TextMatchMarkerListImpl final : public DocumentMarkerList { | 17 class CORE_EXPORT TextMatchMarkerListImpl final : public DocumentMarkerList { |
16 public: | 18 public: |
17 TextMatchMarkerListImpl() = default; | 19 TextMatchMarkerListImpl() = default; |
18 | 20 |
19 // DocumentMarkerList implementations | 21 // DocumentMarkerList implementations |
20 DocumentMarker::MarkerType MarkerType() const final; | 22 DocumentMarker::MarkerType MarkerType() const final; |
21 | 23 |
22 bool IsEmpty() const final; | 24 bool IsEmpty() const final; |
23 | 25 |
24 void Add(DocumentMarker*) final; | 26 void Add(DocumentMarker*) final; |
25 void Clear() final; | 27 void Clear() final; |
26 | 28 |
27 const HeapVector<Member<DocumentMarker>>& GetMarkers() const final; | 29 const HeapVector<Member<DocumentMarker>>& GetMarkers() const final; |
28 | 30 |
29 bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; | 31 bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; |
30 bool RemoveMarkers(unsigned start_offset, int length) final; | 32 bool RemoveMarkers(unsigned start_offset, int length) final; |
31 bool ShiftMarkers(unsigned offset, | 33 bool ShiftMarkers(unsigned offset, |
32 unsigned old_length, | 34 unsigned old_length, |
33 unsigned new_length) final; | 35 unsigned new_length) final; |
34 DECLARE_VIRTUAL_TRACE(); | 36 DECLARE_VIRTUAL_TRACE(); |
35 | 37 |
| 38 // TextMatchMarkerListImpl-specific |
| 39 Vector<IntRect> RenderedRects(const Node&) const; |
| 40 |
36 private: | 41 private: |
37 HeapVector<Member<DocumentMarker>> markers_; | 42 HeapVector<Member<DocumentMarker>> markers_; |
38 | 43 |
39 DISALLOW_COPY_AND_ASSIGN(TextMatchMarkerListImpl); | 44 DISALLOW_COPY_AND_ASSIGN(TextMatchMarkerListImpl); |
40 }; | 45 }; |
41 | 46 |
42 DEFINE_TYPE_CASTS(TextMatchMarkerListImpl, | 47 DEFINE_TYPE_CASTS(TextMatchMarkerListImpl, |
43 DocumentMarkerList, | 48 DocumentMarkerList, |
44 list, | 49 list, |
45 list->MarkerType() == DocumentMarker::kTextMatch, | 50 list->MarkerType() == DocumentMarker::kTextMatch, |
46 list.MarkerType() == DocumentMarker::kTextMatch); | 51 list.MarkerType() == DocumentMarker::kTextMatch); |
47 | 52 |
48 } // namespace blink | 53 } // namespace blink |
49 | 54 |
50 #endif // TextMatchMarkerListImpl_h | 55 #endif // TextMatchMarkerListImpl_h |
OLD | NEW |