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

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

Issue 2904973003: [DMC #15] Add TextMatchMarkerListImpl::SetTextMatchMarkersActive() (Closed)
Patch Set: Created 3 years, 7 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 2d2935103f047ef19e08f38e60197555f39aae63..2adab616d232fc5ee310a7492e9180adacfec3ae 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -611,32 +611,13 @@ bool DocumentMarkerController::SetTextMatchMarkersActive(Node* node,
if (!markers)
return false;
- bool doc_dirty = false;
DocumentMarkerList* const list =
ListForType(markers, DocumentMarker::kTextMatch);
-
if (!list)
return false;
- const HeapVector<Member<DocumentMarker>>& markers_in_list =
- list->GetMarkers();
- // TODO(rlanday): this assumes that the markers are stored in sorted order.
- // This method should probably eventually be implemented by a
- // TextMatch-specific marker list
- const auto start_pos = std::upper_bound(
- markers_in_list.begin(), markers_in_list.end(), start_offset,
- [](size_t start_offset, const Member<DocumentMarker>& marker) {
- return start_offset < marker->EndOffset();
- });
- for (auto marker = start_pos; marker != markers_in_list.end(); ++marker) {
- // Markers are returned in order, so stop if we are now past the specified
- // range.
- if ((*marker)->StartOffset() >= end_offset)
- break;
-
- (*marker)->SetIsActiveMatch(active);
- doc_dirty = true;
- }
+ bool doc_dirty = ToTextMatchMarkerListImpl(list)->SetTextMatchMarkersActive(
+ start_offset, end_offset, active);
// repaint the affected node
if (doc_dirty && node->GetLayoutObject()) {

Powered by Google App Engine
This is Rietveld 408576698