Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.h

Issue 2883503004: [DMC #7] Only create RenderedDocumentMarkers for TextMatchMarkerListImpl (Closed)
Patch Set: Rebase on InvalidateRectsForAllMarkers() refactor Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Nearly-complete implementation of DocumentMarkerList for Spelling or Grammar 12 // Nearly-complete implementation of DocumentMarkerList for Spelling or Grammar
13 // markers (subclassed by SpellingMarkerListImpl and GrammarMarkerListImpl to 13 // markers (subclassed by SpellingMarkerListImpl and GrammarMarkerListImpl to
14 // implement the MarkerType() method). Markers with touching endpoints are 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 15 // merged on insert. Markers are kept sorted by start offset in order to be able
16 // to do this efficiently. 16 // to do this efficiently.
17 class CORE_EXPORT SpellCheckMarkerListImpl : public DocumentMarkerList { 17 class CORE_EXPORT SpellCheckMarkerListImpl : public DocumentMarkerList {
18 public: 18 public:
19 // DocumentMarkerList implementations 19 // DocumentMarkerList implementations
20 bool IsEmpty() const final; 20 bool IsEmpty() const final;
21 21
22 void Add(DocumentMarker*) final; 22 void Add(DocumentMarker*) final;
23 void Clear() final; 23 void Clear() final;
24 24
25 const HeapVector<Member<RenderedDocumentMarker>>& GetMarkers() const final; 25 const HeapVector<Member<DocumentMarker>>& GetMarkers() const final;
26 26
27 bool MoveMarkers(int length, DocumentMarkerList* dst_list) final; 27 bool MoveMarkers(int length, DocumentMarkerList* dst_list) final;
28 bool RemoveMarkers(unsigned start_offset, int length) final; 28 bool RemoveMarkers(unsigned start_offset, int length) final;
29 bool ShiftMarkers(unsigned offset, 29 bool ShiftMarkers(unsigned offset,
30 unsigned old_length, 30 unsigned old_length,
31 unsigned new_length) final; 31 unsigned new_length) final;
32 32
33 DECLARE_VIRTUAL_TRACE(); 33 DECLARE_VIRTUAL_TRACE();
34 34
35 // SpellCheckMarkerListImpl-specific 35 // SpellCheckMarkerListImpl-specific
36 // Returns true if a marker was removed, false otherwise. 36 // Returns true if a marker was removed, false otherwise.
37 bool RemoveMarkersUnderWords(const String& node_text, 37 bool RemoveMarkersUnderWords(const String& node_text,
38 const Vector<String>& words); 38 const Vector<String>& words);
39 39
40 protected: 40 protected:
41 SpellCheckMarkerListImpl() = default; 41 SpellCheckMarkerListImpl() = default;
42 42
43 private: 43 private:
44 HeapVector<Member<RenderedDocumentMarker>> markers_; 44 HeapVector<Member<DocumentMarker>> markers_;
45 45
46 DISALLOW_COPY_AND_ASSIGN(SpellCheckMarkerListImpl); 46 DISALLOW_COPY_AND_ASSIGN(SpellCheckMarkerListImpl);
47 }; 47 };
48 48
49 DEFINE_TYPE_CASTS(SpellCheckMarkerListImpl, 49 DEFINE_TYPE_CASTS(SpellCheckMarkerListImpl,
50 DocumentMarkerList, 50 DocumentMarkerList,
51 list, 51 list,
52 list->MarkerType() == DocumentMarker::kSpelling || 52 list->MarkerType() == DocumentMarker::kSpelling ||
53 list->MarkerType() == DocumentMarker::kGrammar, 53 list->MarkerType() == DocumentMarker::kGrammar,
54 list.MarkerType() == DocumentMarker::kSpelling || 54 list.MarkerType() == DocumentMarker::kSpelling ||
55 list.MarkerType() == DocumentMarker::kGrammar); 55 list.MarkerType() == DocumentMarker::kGrammar);
56 56
57 } // namespace blink 57 } // namespace blink
58 58
59 #endif // SpellCheckMarkerListImpl_h 59 #endif // SpellCheckMarkerListImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698