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

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

Issue 2904973003: [DMC #15] Add TextMatchMarkerListImpl::SetTextMatchMarkersActive() (Closed)
Patch Set: Remove blank lines 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 be31df135c58bc99e68eb65a4d00a4295d3f1890..cc2824902add2e1672da0609fa7ac24c03d9638a 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -625,32 +625,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()) {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698