Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp |
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp |
index 5b7ac5f1ee2ad5e725783d2a7aa81c3cf89b3b67..69733afd6709a13c16b0cfdefbd54daa994e6326 100644 |
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp |
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp |
@@ -82,25 +82,6 @@ bool DocumentMarkerListEditor::RemoveMarkers(MarkerList* list, |
return doc_dirty; |
} |
-bool DocumentMarkerListEditor::RemoveMarkersUnderWords( |
Xiaocheng
2017/04/27 19:04:01
Could you modify this function in-place, and move
|
- MarkerList* list, |
- const String& node_text, |
- const Vector<String>& words) { |
- bool removed_markers = false; |
- for (size_t j = list->size(); j > 0; --j) { |
- const DocumentMarker& marker = *(*list)[j - 1]; |
- const unsigned start = marker.StartOffset(); |
- const unsigned length = marker.EndOffset() - marker.StartOffset(); |
- const String& marker_text = node_text.Substring(start, length); |
- if (words.Contains(marker_text)) { |
- list->erase(j - 1); |
- removed_markers = true; |
- } |
- } |
- |
- return removed_markers; |
-} |
- |
bool DocumentMarkerListEditor::ShiftMarkers(MarkerList* list, |
unsigned offset, |
unsigned old_length, |
@@ -128,36 +109,4 @@ bool DocumentMarkerListEditor::ShiftMarkers(MarkerList* list, |
return did_shift_marker; |
} |
-void DocumentMarkerListEditor::AddMarkerAndMergeOverlapping( |
Xiaocheng
2017/04/27 19:04:01
Could you modify this function in-place, and move
rlanday
2017/04/27 20:30:13
I don't think I'm modifying either of these method
|
- MarkerList* list, |
- const DocumentMarker* marker) { |
- RenderedDocumentMarker* rendered_marker = |
- RenderedDocumentMarker::Create(*marker); |
- if (list->IsEmpty() || list->back()->EndOffset() < marker->StartOffset()) { |
- list->push_back(rendered_marker); |
- return; |
- } |
- |
- auto first_overlapping = std::lower_bound( |
- list->begin(), list->end(), rendered_marker, |
- [](const Member<RenderedDocumentMarker>& marker_in_list, |
- const DocumentMarker* marker_to_insert) { |
- return marker_in_list->EndOffset() < marker_to_insert->StartOffset(); |
- }); |
- |
- size_t index = first_overlapping - list->begin(); |
- list->insert(index, rendered_marker); |
- const auto inserted = list->begin() + index; |
- first_overlapping = inserted + 1; |
- // TODO(rlanday): optimize this loop so it runs in O(N) time and not O(N^2) |
- for (const auto i = first_overlapping; |
- i != list->end() && (*i)->StartOffset() <= (*inserted)->EndOffset();) { |
- (*inserted)->SetStartOffset( |
- std::min((*inserted)->StartOffset(), (*i)->StartOffset())); |
- (*inserted)->SetEndOffset( |
- std::max((*inserted)->EndOffset(), (*i)->EndOffset())); |
- list->erase(i - list->begin()); |
- } |
-} |
- |
} // namespace blink |