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 22 matching lines...) Expand all Loading... |
33 #include "core/dom/SynchronousMutationObserver.h" | 33 #include "core/dom/SynchronousMutationObserver.h" |
34 #include "core/editing/iterators/TextIterator.h" | 34 #include "core/editing/iterators/TextIterator.h" |
35 #include "core/editing/markers/DocumentMarker.h" | 35 #include "core/editing/markers/DocumentMarker.h" |
36 #include "platform/geometry/IntRect.h" | 36 #include "platform/geometry/IntRect.h" |
37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
38 #include "platform/wtf/HashMap.h" | 38 #include "platform/wtf/HashMap.h" |
39 #include "platform/wtf/Vector.h" | 39 #include "platform/wtf/Vector.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
| 43 class DocumentMarkerList; |
43 class Node; | 44 class Node; |
44 class RenderedDocumentMarker; | 45 class RenderedDocumentMarker; |
45 class Text; | 46 class Text; |
46 | 47 |
47 class MarkerRemoverPredicate final { | 48 class MarkerRemoverPredicate final { |
48 public: | 49 public: |
49 explicit MarkerRemoverPredicate(const Vector<String>& words); | 50 explicit MarkerRemoverPredicate(const Vector<String>& words); |
50 bool operator()(const DocumentMarker&, const Text&) const; | 51 bool operator()(const DocumentMarker&, const Text&) const; |
51 | 52 |
52 private: | 53 private: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void ShowMarkers() const; | 121 void ShowMarkers() const; |
121 #endif | 122 #endif |
122 | 123 |
123 // SynchronousMutationObserver | 124 // SynchronousMutationObserver |
124 void DidUpdateCharacterData(CharacterData*, | 125 void DidUpdateCharacterData(CharacterData*, |
125 unsigned offset, | 126 unsigned offset, |
126 unsigned old_length, | 127 unsigned old_length, |
127 unsigned new_length) final; | 128 unsigned new_length) final; |
128 | 129 |
129 private: | 130 private: |
130 void AddMarker(Node*, const DocumentMarker&); | 131 void AddMarker(Node*, DocumentMarker*); |
131 | 132 |
132 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; | 133 using MarkerLists = HeapVector<Member<DocumentMarkerList>, |
133 using MarkerLists = | 134 DocumentMarker::kMarkerTypeIndexesCount>; |
134 HeapVector<Member<MarkerList>, DocumentMarker::kMarkerTypeIndexesCount>; | |
135 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; | 135 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; |
136 static Member<MarkerList>& ListForType(MarkerLists*, | 136 static Member<DocumentMarkerList>& ListForType(MarkerLists*, |
137 DocumentMarker::MarkerType); | 137 DocumentMarker::MarkerType); |
138 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); | 138 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); |
139 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); | 139 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); |
140 void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes); | 140 void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes); |
141 | 141 |
142 MarkerMap markers_; | 142 MarkerMap markers_; |
143 // Provide a quick way to determine whether a particular marker type is absent | 143 // Provide a quick way to determine whether a particular marker type is absent |
144 // without going through the map. | 144 // without going through the map. |
145 DocumentMarker::MarkerTypes possibly_existing_marker_types_; | 145 DocumentMarker::MarkerTypes possibly_existing_marker_types_; |
146 const Member<const Document> document_; | 146 const Member<const Document> document_; |
147 }; | 147 }; |
148 | 148 |
149 } // namespace blink | 149 } // namespace blink |
150 | 150 |
151 #ifndef NDEBUG | 151 #ifndef NDEBUG |
152 void showDocumentMarkers(const blink::DocumentMarkerController*); | 152 void showDocumentMarkers(const blink::DocumentMarkerController*); |
153 #endif | 153 #endif |
154 | 154 |
155 #endif // DocumentMarkerController_h | 155 #endif // DocumentMarkerController_h |
OLD | NEW |