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 | 46 |
46 class CORE_EXPORT DocumentMarkerController final | 47 class CORE_EXPORT DocumentMarkerController final |
47 : public GarbageCollected<DocumentMarkerController>, | 48 : public GarbageCollected<DocumentMarkerController>, |
48 public SynchronousMutationObserver { | 49 public SynchronousMutationObserver { |
49 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); | 50 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); |
50 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); | 51 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); |
51 | 52 |
52 public: | 53 public: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 105 |
105 // SynchronousMutationObserver | 106 // SynchronousMutationObserver |
106 void DidUpdateCharacterData(CharacterData*, | 107 void DidUpdateCharacterData(CharacterData*, |
107 unsigned offset, | 108 unsigned offset, |
108 unsigned old_length, | 109 unsigned old_length, |
109 unsigned new_length) final; | 110 unsigned new_length) final; |
110 | 111 |
111 private: | 112 private: |
112 void AddMarker(Node*, DocumentMarker*); | 113 void AddMarker(Node*, DocumentMarker*); |
113 | 114 |
114 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; | 115 using MarkerLists = HeapVector<Member<DocumentMarkerList>, |
115 using MarkerLists = | 116 DocumentMarker::kMarkerTypeIndexesCount>; |
116 HeapVector<Member<MarkerList>, DocumentMarker::kMarkerTypeIndexesCount>; | |
117 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; | 117 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; |
118 static Member<MarkerList>& ListForType(MarkerLists*, | 118 static Member<DocumentMarkerList>& ListForType(MarkerLists*, |
119 DocumentMarker::MarkerType); | 119 DocumentMarker::MarkerType); |
120 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); | 120 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); |
121 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); | 121 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); |
122 void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes); | 122 void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes); |
123 void RemoveMarkersInternal(Node*, | 123 void RemoveMarkersInternal(Node*, |
124 unsigned start_offset, | 124 unsigned start_offset, |
125 int length, | 125 int length, |
126 DocumentMarker::MarkerTypes); | 126 DocumentMarker::MarkerTypes); |
127 | 127 |
128 MarkerMap markers_; | 128 MarkerMap markers_; |
129 // Provide a quick way to determine whether a particular marker type is absent | 129 // Provide a quick way to determine whether a particular marker type is absent |
130 // without going through the map. | 130 // without going through the map. |
131 DocumentMarker::MarkerTypes possibly_existing_marker_types_; | 131 DocumentMarker::MarkerTypes possibly_existing_marker_types_; |
132 const Member<const Document> document_; | 132 const Member<const Document> document_; |
133 }; | 133 }; |
134 | 134 |
135 } // namespace blink | 135 } // namespace blink |
136 | 136 |
137 #ifndef NDEBUG | 137 #ifndef NDEBUG |
138 void showDocumentMarkers(const blink::DocumentMarkerController*); | 138 void showDocumentMarkers(const blink::DocumentMarkerController*); |
139 #endif | 139 #endif |
140 | 140 |
141 #endif // DocumentMarkerController_h | 141 #endif // DocumentMarkerController_h |
OLD | NEW |