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

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

Issue 2773883003: Add CompositionMarkerList in preparation for DocumentMarkerController refactor (Closed)
Patch Set: Fix code that doesn't compile...what am I doing... Created 3 years, 9 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 /* 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 class CORE_EXPORT DocumentMarkerController final 56 class CORE_EXPORT DocumentMarkerController final
57 : public GarbageCollected<DocumentMarkerController>, 57 : public GarbageCollected<DocumentMarkerController>,
58 public SynchronousMutationObserver { 58 public SynchronousMutationObserver {
59 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); 59 WTF_MAKE_NONCOPYABLE(DocumentMarkerController);
60 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); 60 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController);
61 61
62 public: 62 public:
63 explicit DocumentMarkerController(Document&); 63 explicit DocumentMarkerController(Document&);
64 64
65 void clear(); 65 void clear();
66 void addMarker(Node*, const DocumentMarker&);
66 void addMarker(const Position& start, 67 void addMarker(const Position& start,
67 const Position& end, 68 const Position& end,
68 DocumentMarker::MarkerType, 69 DocumentMarker::MarkerType,
69 const String& description = emptyString); 70 const String& description = emptyString);
70 void addTextMatchMarker(const EphemeralRange&, bool activeMatch); 71 void addTextMatchMarker(const EphemeralRange&, bool activeMatch);
71 void addCompositionMarker(const Position& start, 72 void addCompositionMarker(const Position& start,
72 const Position& end, 73 const Position& end,
73 Color underlineColor, 74 Color underlineColor,
74 bool thick, 75 bool thick,
75 Color backgroundColor); 76 Color backgroundColor);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 void showMarkers() const; 133 void showMarkers() const;
133 #endif 134 #endif
134 135
135 // SynchronousMutationObserver 136 // SynchronousMutationObserver
136 void didUpdateCharacterData(CharacterData*, 137 void didUpdateCharacterData(CharacterData*,
137 unsigned offset, 138 unsigned offset,
138 unsigned oldLength, 139 unsigned oldLength,
139 unsigned newLength) final; 140 unsigned newLength) final;
140 141
141 private: 142 private:
142 void addMarker(Node*, const DocumentMarker&);
143
144 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; 143 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>;
145 using MarkerLists = 144 using MarkerLists =
146 HeapVector<Member<MarkerList>, DocumentMarker::MarkerTypeIndexesCount>; 145 HeapVector<Member<MarkerList>, DocumentMarker::MarkerTypeIndexesCount>;
147 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; 146 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>;
148 void mergeOverlapping(MarkerList*, RenderedDocumentMarker*); 147 void mergeOverlapping(MarkerList*, RenderedDocumentMarker*);
149 bool possiblyHasMarkers(DocumentMarker::MarkerTypes); 148 bool possiblyHasMarkers(DocumentMarker::MarkerTypes);
150 bool relocateMarkerIfNeeded(RenderedDocumentMarker*, 149 bool relocateMarkerIfNeeded(RenderedDocumentMarker*,
151 unsigned offset, 150 unsigned offset,
152 unsigned oldLength, 151 unsigned oldLength,
153 unsigned newLength); 152 unsigned newLength);
154 void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); 153 void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes);
155 void removeMarkers(TextIterator&, 154 void removeMarkers(TextIterator&,
156 DocumentMarker::MarkerTypes, 155 DocumentMarker::MarkerTypes,
157 RemovePartiallyOverlappingMarkerOrNot); 156 RemovePartiallyOverlappingMarkerOrNot);
158 157
159 MarkerMap m_markers; 158 MarkerMap m_markers;
160 // Provide a quick way to determine whether a particular marker type is absent 159 // Provide a quick way to determine whether a particular marker type is absent
161 // without going through the map. 160 // without going through the map.
162 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; 161 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes;
163 const Member<const Document> m_document; 162 const Member<const Document> m_document;
164 }; 163 };
165 164
166 } // namespace blink 165 } // namespace blink
167 166
168 #ifndef NDEBUG 167 #ifndef NDEBUG
169 void showDocumentMarkers(const blink::DocumentMarkerController*); 168 void showDocumentMarkers(const blink::DocumentMarkerController*);
170 #endif 169 #endif
171 170
172 #endif // DocumentMarkerController_h 171 #endif // DocumentMarkerController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698