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 SpellCheckMarkerListImpl_h | 5 #ifndef SpellCheckMarkerListImpl_h |
6 #define SpellCheckMarkerListImpl_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 // Implementation of DocumentMarkerList for Spelling/Grammar markers. | 12 // Nearly-complete implementation of DocumentMarkerList for Spelling or Grammar |
13 // Markers with touching endpoints are merged on insert. Markers are kept sorted | 13 // markers (subclassed by SpellingMarkerListImpl and GrammarMarkerListImpl to |
14 // by start offset in order to be able to do this efficiently. | 14 // implement the MarkerType() method). Markers with touching endpoints are |
15 // merged on insert. Markers are kept sorted by start offset in order to be able | |
16 // to do this efficiently. | |
15 class CORE_EXPORT SpellCheckMarkerListImpl : public DocumentMarkerList { | 17 class CORE_EXPORT SpellCheckMarkerListImpl : public DocumentMarkerList { |
16 public: | 18 public: |
17 SpellCheckMarkerListImpl() = default; | 19 SpellCheckMarkerListImpl() = default; |
yosin_UTC9
2017/05/12 05:00:04
nit: We should get move ctor of SpellCheckMarkerLi
| |
18 | 20 |
19 // DocumentMarkerList implementations | 21 // DocumentMarkerList implementations |
20 bool IsEmpty() const final; | 22 bool IsEmpty() const final; |
21 | 23 |
22 void Add(DocumentMarker*) final; | 24 void Add(DocumentMarker*) final; |
23 void Clear() final; | 25 void Clear() final; |
24 | 26 |
25 const HeapVector<Member<RenderedDocumentMarker>>& GetMarkers() const final; | 27 const HeapVector<Member<RenderedDocumentMarker>>& GetMarkers() const final; |
26 | 28 |
27 bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; | 29 bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; |
28 bool RemoveMarkers(unsigned start_offset, int length) final; | 30 bool RemoveMarkers(unsigned start_offset, int length) final; |
29 bool RemoveMarkersUnderWords(const String& node_text, | 31 bool RemoveMarkersUnderWords(const String& node_text, |
30 const Vector<String>& words); | 32 const Vector<String>& words); |
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 | 36 |
35 DECLARE_VIRTUAL_TRACE(); | 37 DECLARE_VIRTUAL_TRACE(); |
36 | 38 |
37 private: | 39 private: |
38 HeapVector<Member<RenderedDocumentMarker>> markers_; | 40 HeapVector<Member<RenderedDocumentMarker>> markers_; |
39 | 41 |
40 DISALLOW_COPY_AND_ASSIGN(SpellCheckMarkerListImpl); | 42 DISALLOW_COPY_AND_ASSIGN(SpellCheckMarkerListImpl); |
41 }; | 43 }; |
42 | 44 |
43 } // namespace blink | 45 } // namespace blink |
44 | 46 |
45 #endif // SpellCheckMarkerListImpl_h | 47 #endif // SpellCheckMarkerListImpl_h |
OLD | NEW |