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 GenericDocumentMarkerListImpl_h | 5 #ifndef SpellCheckMarkerListImpl_h |
6 #define GenericDocumentMarkerListImpl_h | 6 #define SpellCheckMarkerListImpl_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 RenderedDocumentMarker; | 12 // Implementation of DocumentMarkerList for Spelling/Grammar markers. |
13 | 13 // Markers with touching endpoints are merged on insert. Markers are kept sorted |
14 // Temporary implementation of DocumentMarkerList that can handle | 14 // by start offset in order to be able to do this efficiently. |
15 // DocumentMarkers of all MarkerTypes. This will be removed once we have | 15 class CORE_EXPORT SpellCheckMarkerListImpl : public DocumentMarkerList { |
16 // specialized implementations for every MarkerType. | |
17 class GenericDocumentMarkerListImpl final : public DocumentMarkerList { | |
18 public: | 16 public: |
19 GenericDocumentMarkerListImpl() = default; | 17 SpellCheckMarkerListImpl() = default; |
20 | 18 |
21 // DocumentMarkerList implementations | 19 // DocumentMarkerList implementations |
22 bool IsEmpty() const final; | 20 bool IsEmpty() const final; |
23 | 21 |
24 void Add(DocumentMarker*) final; | 22 void Add(DocumentMarker*) final; |
25 void Clear() final; | 23 void Clear() final; |
26 | 24 |
27 const HeapVector<Member<RenderedDocumentMarker>>& GetMarkers() const final; | 25 const HeapVector<Member<RenderedDocumentMarker>>& GetMarkers() const final; |
28 | 26 |
29 bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; | 27 bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; |
30 bool RemoveMarkers(unsigned start_offset, int length) final; | 28 bool RemoveMarkers(unsigned start_offset, int length) final; |
31 bool RemoveMarkersUnderWords(const String& node_text, | |
32 const Vector<String>& words) final; | |
33 bool ShiftMarkers(unsigned offset, | 29 bool ShiftMarkers(unsigned offset, |
34 unsigned old_length, | 30 unsigned old_length, |
35 unsigned new_length) final; | 31 unsigned new_length) final; |
32 DECLARE_VIRTUAL_TRACE(); | |
Xiaocheng
2017/04/27 22:04:38
Please make sure all other impls use DECLARE_VIRTU
| |
36 | 33 |
37 DECLARE_TRACE(); | 34 // SpellCheckMarkerListImpl-specific |
35 // Returns true if a marker was removed, false otherwise. | |
36 bool RemoveMarkersUnderWords(const String& node_text, | |
37 const Vector<String>& words); | |
38 | 38 |
39 private: | 39 private: |
40 HeapVector<Member<RenderedDocumentMarker>> markers_; | 40 HeapVector<Member<RenderedDocumentMarker>> markers_; |
41 | 41 |
42 DISALLOW_COPY_AND_ASSIGN(GenericDocumentMarkerListImpl); | 42 DISALLOW_COPY_AND_ASSIGN(SpellCheckMarkerListImpl); |
43 }; | 43 }; |
44 | 44 |
45 } // namespace blink | 45 } // namespace blink |
46 | 46 |
47 #endif // GenericDocumentMarkerListImpl_h | 47 #endif // SpellCheckMarkerListImpl_h |
OLD | NEW |