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

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp

Issue 2784753002: Add TextMatchMarkerList in preparation for DocumentMarkerController refactor (Closed)
Patch Set: Remove unnecessary TextMatchMarker constructor 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
index 32abf9d8d5a5e3cbf05e521a1eefd3c3a0ca172d..5fc02e1cd1af11e3a209c22ea2d18f85a7c369b5 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -373,7 +373,7 @@ void DocumentMarkerController::removeMarkers(
MarkerList::iterator startPos =
std::upper_bound(list->begin(), list->end(), startOffset, endsBefore);
for (MarkerList::iterator i = startPos; i != list->end();) {
- DocumentMarker marker(*i->get());
+ const DocumentMarker& marker(*i->get());
// markers are returned in order, so stop if we are now past the specified
// range
@@ -393,18 +393,18 @@ void DocumentMarkerController::removeMarkers(
// add either of the resulting slices that are left after removing target
if (startOffset > marker.startOffset()) {
- DocumentMarker newLeft = marker;
- newLeft.setEndOffset(startOffset);
+ DocumentMarker* newLeft = marker.clone();
+ newLeft->setEndOffset(startOffset);
size_t insertIndex = i - list->begin();
- list->insert(insertIndex, RenderedDocumentMarker::create(newLeft));
+ list->insert(insertIndex, RenderedDocumentMarker::create(*newLeft));
// Move to the marker after the inserted one.
i = list->begin() + insertIndex + 1;
}
if (marker.endOffset() > endOffset) {
- DocumentMarker newRight = marker;
- newRight.setStartOffset(endOffset);
+ DocumentMarker* newRight = marker.clone();
+ newRight->setStartOffset(endOffset);
size_t insertIndex = i - list->begin();
- list->insert(insertIndex, RenderedDocumentMarker::create(newRight));
+ list->insert(insertIndex, RenderedDocumentMarker::create(*newRight));
// Move to the marker after the inserted one.
i = list->begin() + insertIndex + 1;
}

Powered by Google App Engine
This is Rietveld 408576698