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

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 (no manual changes) 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void AddTextMatchMarker(const EphemeralRange&, DocumentMarker::MatchStatus); 70 void AddTextMatchMarker(const EphemeralRange&, DocumentMarker::MatchStatus);
71 void AddCompositionMarker(const Position& start, 71 void AddCompositionMarker(const Position& start,
72 const Position& end, 72 const Position& end,
73 Color underline_color, 73 Color underline_color,
74 bool thick, 74 bool thick,
75 Color background_color); 75 Color background_color);
76 76
77 void MoveMarkers(Node* src_node, int length, Node* dst_node); 77 void MoveMarkers(Node* src_node, int length, Node* dst_node);
78 78
79 void PrepareForDestruction(); 79 void PrepareForDestruction();
80 // When a marker partially overlaps with range, if 80 void RemoveMarkers(
81 // removePartiallyOverlappingMarkers is true, we completely remove the marker. 81 const EphemeralRange&,
82 // If the argument is false, we will adjust the span of the marker so that it 82 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
83 // retains the portion that is outside of the range. 83 void RemoveMarkers(
84 enum RemovePartiallyOverlappingMarkerOrNot { 84 Node*,
85 kDoNotRemovePartiallyOverlappingMarker, 85 unsigned start_offset,
86 kRemovePartiallyOverlappingMarker 86 int length,
87 }; 87 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
88 void RemoveMarkers(const EphemeralRange&,
89 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(),
90 RemovePartiallyOverlappingMarkerOrNot =
91 kDoNotRemovePartiallyOverlappingMarker);
92 void RemoveMarkers(Node*,
93 unsigned start_offset,
94 int length,
95 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(),
96 RemovePartiallyOverlappingMarkerOrNot =
97 kDoNotRemovePartiallyOverlappingMarker);
98
99 void RemoveMarkers( 88 void RemoveMarkers(
100 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); 89 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
101 void RemoveMarkers( 90 void RemoveMarkers(
102 Node*, 91 Node*,
103 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); 92 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
104 void RemoveMarkers(const MarkerRemoverPredicate& should_remove_marker); 93 void RemoveMarkers(const MarkerRemoverPredicate& should_remove_marker);
105 void RepaintMarkers( 94 void RepaintMarkers(
106 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); 95 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
107 // Returns true if markers within a range are found. 96 // Returns true if markers within a range are found.
108 bool SetMarkersActive(const EphemeralRange&, bool); 97 bool SetMarkersActive(const EphemeralRange&, bool);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 private: 129 private:
141 void AddMarker(Node*, const DocumentMarker&); 130 void AddMarker(Node*, const DocumentMarker&);
142 131
143 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; 132 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>;
144 using MarkerLists = 133 using MarkerLists =
145 HeapVector<Member<MarkerList>, DocumentMarker::kMarkerTypeIndexesCount>; 134 HeapVector<Member<MarkerList>, DocumentMarker::kMarkerTypeIndexesCount>;
146 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; 135 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>;
147 void MergeOverlapping(MarkerList*, RenderedDocumentMarker*); 136 void MergeOverlapping(MarkerList*, RenderedDocumentMarker*);
148 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); 137 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes);
149 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); 138 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes);
150 void RemoveMarkers(TextIterator&, 139 void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes);
151 DocumentMarker::MarkerTypes,
152 RemovePartiallyOverlappingMarkerOrNot);
153 140
154 MarkerMap markers_; 141 MarkerMap markers_;
155 // Provide a quick way to determine whether a particular marker type is absent 142 // Provide a quick way to determine whether a particular marker type is absent
156 // without going through the map. 143 // without going through the map.
157 DocumentMarker::MarkerTypes possibly_existing_marker_types_; 144 DocumentMarker::MarkerTypes possibly_existing_marker_types_;
158 const Member<const Document> document_; 145 const Member<const Document> document_;
159 }; 146 };
160 147
161 } // namespace blink 148 } // namespace blink
162 149
163 #ifndef NDEBUG 150 #ifndef NDEBUG
164 void showDocumentMarkers(const blink::DocumentMarkerController*); 151 void showDocumentMarkers(const blink::DocumentMarkerController*);
165 #endif 152 #endif
166 153
167 #endif // DocumentMarkerController_h 154 #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