| 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 CompositionMarkerListImpl_h | 5 #ifndef CompositionMarkerListImpl_h |
| 6 #define CompositionMarkerListImpl_h | 6 #define CompositionMarkerListImpl_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 // Implementation of DocumentMarkerList for Composition markers. | 12 // Implementation of DocumentMarkerList for Composition markers. |
| 13 // Composition markers are always inserted in order, aside from some potential | 13 // Composition markers are always inserted in order, aside from some potential |
| 14 // oddball cases (e.g. splitting the marker list into two nodes, then undoing | 14 // oddball cases (e.g. splitting the marker list into two nodes, then undoing |
| 15 // the split). This means we can keep the list in sorted order to do some | 15 // the split). This means we can keep the list in sorted order to do some |
| 16 // operations more efficiently, while still being able to do inserts in O(1) | 16 // operations more efficiently, while still being able to do inserts in O(1) |
| 17 // time at the end of the list. | 17 // time at the end of the list. |
| 18 class CORE_EXPORT CompositionMarkerListImpl final : public DocumentMarkerList { | 18 class CORE_EXPORT CompositionMarkerListImpl final : public DocumentMarkerList { |
| 19 public: | 19 public: |
| 20 CompositionMarkerListImpl() = default; | 20 CompositionMarkerListImpl() = default; |
| 21 | 21 |
| 22 // DocumentMarkerList implementations | 22 // DocumentMarkerList implementations |
| 23 DocumentMarker::MarkerType MarkerType() const final; |
| 24 |
| 23 bool IsEmpty() const final; | 25 bool IsEmpty() const final; |
| 24 | 26 |
| 25 void Add(DocumentMarker*) final; | 27 void Add(DocumentMarker*) final; |
| 26 void Clear() final; | 28 void Clear() final; |
| 27 | 29 |
| 28 const HeapVector<Member<RenderedDocumentMarker>>& GetMarkers() const final; | 30 const HeapVector<Member<RenderedDocumentMarker>>& GetMarkers() const final; |
| 29 | 31 |
| 30 bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; | 32 bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; |
| 31 bool RemoveMarkers(unsigned start_offset, int length) final; | 33 bool RemoveMarkers(unsigned start_offset, int length) final; |
| 32 bool RemoveMarkersUnderWords(const String& node_text, | 34 bool RemoveMarkersUnderWords(const String& node_text, |
| 33 const Vector<String>& words) final; | 35 const Vector<String>& words) final; |
| 34 bool ShiftMarkers(unsigned offset, | 36 bool ShiftMarkers(unsigned offset, |
| 35 unsigned old_length, | 37 unsigned old_length, |
| 36 unsigned new_length) final; | 38 unsigned new_length) final; |
| 37 | 39 |
| 38 DECLARE_VIRTUAL_TRACE(); | 40 DECLARE_VIRTUAL_TRACE(); |
| 39 | 41 |
| 40 private: | 42 private: |
| 41 HeapVector<Member<RenderedDocumentMarker>> markers_; | 43 HeapVector<Member<RenderedDocumentMarker>> markers_; |
| 42 | 44 |
| 43 DISALLOW_COPY_AND_ASSIGN(CompositionMarkerListImpl); | 45 DISALLOW_COPY_AND_ASSIGN(CompositionMarkerListImpl); |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 } // namespace blink | 48 } // namespace blink |
| 47 | 49 |
| 48 #endif // CompositionMarkerListImpl_h | 50 #endif // CompositionMarkerListImpl_h |
| OLD | NEW |