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

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

Issue 2806683002: Don't ever split DocumentMarkers on remove (Closed)
Patch Set: Rebase on test cases I'm adding in another CL Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 unsigned start_offset, 78 unsigned start_offset,
79 int length, 79 int length,
80 Node* dst_node, 80 Node* dst_node,
81 int delta); 81 int delta);
82 82
83 void PrepareForDestruction(); 83 void PrepareForDestruction();
84 // When a marker partially overlaps with range, if 84 // When a marker partially overlaps with range, if
85 // removePartiallyOverlappingMarkers is true, we completely remove the marker. 85 // removePartiallyOverlappingMarkers is true, we completely remove the marker.
86 // If the argument is false, we will adjust the span of the marker so that it 86 // If the argument is false, we will adjust the span of the marker so that it
87 // retains the portion that is outside of the range. 87 // retains the portion that is outside of the range.
88 enum RemovePartiallyOverlappingMarkerOrNot { 88 enum RemovePartiallyOverlappingMarkerOrNot {
Xiaocheng 2017/04/10 21:22:10 Please also remove this enum.
89 kDoNotRemovePartiallyOverlappingMarker, 89 kDoNotRemovePartiallyOverlappingMarker,
90 kRemovePartiallyOverlappingMarker 90 kRemovePartiallyOverlappingMarker
91 }; 91 };
92 void RemoveMarkers(const EphemeralRange&, 92 void RemoveMarkers(
93 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(), 93 const EphemeralRange&,
94 RemovePartiallyOverlappingMarkerOrNot = 94 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
95 kDoNotRemovePartiallyOverlappingMarker); 95 void RemoveMarkers(
96 void RemoveMarkers(Node*, 96 Node*,
97 unsigned start_offset, 97 unsigned start_offset,
98 int length, 98 int length,
99 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(), 99 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
100 RemovePartiallyOverlappingMarkerOrNot =
101 kDoNotRemovePartiallyOverlappingMarker);
102
103 void RemoveMarkers( 100 void RemoveMarkers(
104 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); 101 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
105 void RemoveMarkers( 102 void RemoveMarkers(
106 Node*, 103 Node*,
107 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); 104 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
108 void RemoveMarkers(const MarkerRemoverPredicate& should_remove_marker); 105 void RemoveMarkers(const MarkerRemoverPredicate& should_remove_marker);
109 void RepaintMarkers( 106 void RepaintMarkers(
110 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); 107 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
111 // Returns true if markers within a range are found. 108 // Returns true if markers within a range are found.
112 bool SetMarkersActive(const EphemeralRange&, bool); 109 bool SetMarkersActive(const EphemeralRange&, bool);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 private: 141 private:
145 void AddMarker(Node*, const DocumentMarker&); 142 void AddMarker(Node*, const DocumentMarker&);
146 143
147 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; 144 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>;
148 using MarkerLists = 145 using MarkerLists =
149 HeapVector<Member<MarkerList>, DocumentMarker::kMarkerTypeIndexesCount>; 146 HeapVector<Member<MarkerList>, DocumentMarker::kMarkerTypeIndexesCount>;
150 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; 147 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>;
151 void MergeOverlapping(MarkerList*, RenderedDocumentMarker*); 148 void MergeOverlapping(MarkerList*, RenderedDocumentMarker*);
152 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); 149 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes);
153 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); 150 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes);
154 void RemoveMarkers(TextIterator&, 151 void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes);
155 DocumentMarker::MarkerTypes,
156 RemovePartiallyOverlappingMarkerOrNot);
157 152
158 MarkerMap markers_; 153 MarkerMap markers_;
159 // Provide a quick way to determine whether a particular marker type is absent 154 // Provide a quick way to determine whether a particular marker type is absent
160 // without going through the map. 155 // without going through the map.
161 DocumentMarker::MarkerTypes possibly_existing_marker_types_; 156 DocumentMarker::MarkerTypes possibly_existing_marker_types_;
162 const Member<const Document> document_; 157 const Member<const Document> document_;
163 }; 158 };
164 159
165 } // namespace blink 160 } // namespace blink
166 161
167 #ifndef NDEBUG 162 #ifndef NDEBUG
168 void showDocumentMarkers(const blink::DocumentMarkerController*); 163 void showDocumentMarkers(const blink::DocumentMarkerController*);
169 #endif 164 #endif
170 165
171 #endif // DocumentMarkerController_h 166 #endif // DocumentMarkerController_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698