OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
7 * reserved. | 7 * reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 | 46 |
47 class MarkerRemoverPredicate final { | 47 class MarkerRemoverPredicate final { |
48 public: | 48 public: |
49 explicit MarkerRemoverPredicate(const Vector<String>& words); | 49 explicit MarkerRemoverPredicate(const Vector<String>& words); |
50 bool operator()(const DocumentMarker&, const Text&) const; | 50 bool operator()(const DocumentMarker&, const Text&) const; |
51 | 51 |
52 private: | 52 private: |
53 Vector<String> words_; | 53 Vector<String> words_; |
54 }; | 54 }; |
55 | 55 |
56 class DocumentMarkerListEditor { | |
57 public: | |
58 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; | |
59 | |
60 static void AddMarker(MarkerList*, const DocumentMarker*); | |
61 | |
62 static bool RemoveMarkers(MarkerList*, unsigned start_offset, int length); | |
63 static bool ShiftMarkers(MarkerList*, | |
yosin_UTC9
2017/04/17 06:59:01
nit: Please add a comment for |bool| return value.
| |
64 unsigned offset, | |
65 unsigned old_length, | |
66 unsigned new_length); | |
67 | |
68 private: | |
69 static void MergeOverlapping(MarkerList*, RenderedDocumentMarker* to_insert); | |
70 }; | |
71 | |
56 class CORE_EXPORT DocumentMarkerController final | 72 class CORE_EXPORT DocumentMarkerController final |
57 : public GarbageCollected<DocumentMarkerController>, | 73 : public GarbageCollected<DocumentMarkerController>, |
58 public SynchronousMutationObserver { | 74 public SynchronousMutationObserver { |
59 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); | 75 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); |
60 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); | 76 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); |
61 | 77 |
62 public: | 78 public: |
63 explicit DocumentMarkerController(Document&); | 79 explicit DocumentMarkerController(Document&); |
64 | 80 |
65 void Clear(); | 81 void Clear(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 unsigned old_length, | 142 unsigned old_length, |
127 unsigned new_length) final; | 143 unsigned new_length) final; |
128 | 144 |
129 private: | 145 private: |
130 void AddMarker(Node*, const DocumentMarker&); | 146 void AddMarker(Node*, const DocumentMarker&); |
131 | 147 |
132 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; | 148 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; |
133 using MarkerLists = | 149 using MarkerLists = |
134 HeapVector<Member<MarkerList>, DocumentMarker::kMarkerTypeIndexesCount>; | 150 HeapVector<Member<MarkerList>, DocumentMarker::kMarkerTypeIndexesCount>; |
135 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; | 151 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; |
136 void MergeOverlapping(MarkerList*, RenderedDocumentMarker*); | |
137 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); | 152 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); |
138 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); | 153 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); |
139 void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes); | 154 void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes); |
140 | 155 |
141 MarkerMap markers_; | 156 MarkerMap markers_; |
142 // Provide a quick way to determine whether a particular marker type is absent | 157 // Provide a quick way to determine whether a particular marker type is absent |
143 // without going through the map. | 158 // without going through the map. |
144 DocumentMarker::MarkerTypes possibly_existing_marker_types_; | 159 DocumentMarker::MarkerTypes possibly_existing_marker_types_; |
145 const Member<const Document> document_; | 160 const Member<const Document> document_; |
146 }; | 161 }; |
147 | 162 |
148 } // namespace blink | 163 } // namespace blink |
149 | 164 |
150 #ifndef NDEBUG | 165 #ifndef NDEBUG |
151 void showDocumentMarkers(const blink::DocumentMarkerController*); | 166 void showDocumentMarkers(const blink::DocumentMarkerController*); |
152 #endif | 167 #endif |
153 | 168 |
154 #endif // DocumentMarkerController_h | 169 #endif // DocumentMarkerController_h |
OLD | NEW |